From 55a06967f7a634dec8b804a9002d28d2ea2d207a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Jan 2017 22:17:47 +0530 Subject: [PATCH] On second thoughts prevent all backslash escape sequences from being interpreted in normal mode replace strings --- src/calibre/gui2/tweak_book/search.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index b835ed4b4d..fcdd30d638 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -1219,7 +1219,8 @@ def get_search_function(state): ans = state['replace'] is_regex = state['mode'] != 'normal' if not is_regex: - ans = regex.sub(r'\\([0-9g])', r'\\\\\1', ans) + # We dont want backslash escape sequences interpreted in normal mode + return lambda m: ans if state['mode'] == 'function': try: return replace_functions()[ans]