diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py
index 657a57bb26..02cd4d4e5e 100644
--- a/src/calibre/gui2/tweak_book/search.py
+++ b/src/calibre/gui2/tweak_book/search.py
@@ -208,7 +208,8 @@ class ModeBox(QComboBox):
'''Select how the search expression is interpreted
- Normal
- - The search expression is treated as normal text, calibre will look for the exact text.
+ - The search expression is treated as normal text, calibre will look for the exact text,
+ except that spaces are allowed to match any number of spaces and line breaks.
- Regex
- The search expression is interpreted as a regular expression. See the User Manual for more help on using regular expressions.
- Regex-function
@@ -1272,7 +1273,8 @@ def get_search_regex(state):
raw = state['find']
is_regex = state['mode'] != 'normal'
if not is_regex:
- raw = regex.escape(raw, special_only=True)
+ parts = (regex.escape(x, special_only=True) for x in raw.split())
+ raw = r'\s+'.join(parts)
flags = REGEX_FLAGS
if not state['case_sensitive']:
flags |= regex.IGNORECASE