From ced585923fc8109a6193a2fd42dac59470d608ca Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 8 Apr 2020 22:58:42 +0530 Subject: [PATCH] ... --- src/calibre/gui2/viewer/search.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/viewer/search.py b/src/calibre/gui2/viewer/search.py index bc8fe2a65f..5efc6c28ed 100644 --- a/src/calibre/gui2/viewer/search.py +++ b/src/calibre/gui2/viewer/search.py @@ -58,6 +58,8 @@ spat = regex.compile(r'(\s+)') def text_to_regex(text): has_leading = text.lstrip() != text has_trailing = text.rstrip() != text + if text and not text.strip(): + return r'\s+' ans = [] for wpart in spat.split(text.strip()): if not wpart.strip():