This commit is contained in:
Kovid Goyal 2020-04-08 22:58:42 +05:30
parent 17b812ea31
commit ced585923f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -58,6 +58,8 @@ spat = regex.compile(r'(\s+)')
def text_to_regex(text): def text_to_regex(text):
has_leading = text.lstrip() != text has_leading = text.lstrip() != text
has_trailing = text.rstrip() != text has_trailing = text.rstrip() != text
if text and not text.strip():
return r'\s+'
ans = [] ans = []
for wpart in spat.split(text.strip()): for wpart in spat.split(text.strip()):
if not wpart.strip(): if not wpart.strip():