mirror of
https://github.com/wting/autojump
synced 2026-03-02 03:49:26 +00:00
Add match_anywhere tests.
This commit is contained in:
@@ -37,7 +37,7 @@ def match_anywhere(needles, haystack, ignore_case=False):
|
||||
(path='/foo/baz', weight=10),
|
||||
]
|
||||
"""
|
||||
regex_needle = '.*' + '.*'.join(needles).replace('\\', '\\\\') + '.*'
|
||||
regex_needle = '.*' + '.*'.join(imap(re.escape, needles)) + '.*'
|
||||
regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE
|
||||
found = lambda haystack: re.search(
|
||||
regex_needle,
|
||||
|
||||
Reference in New Issue
Block a user