diff --git a/bin/autojump b/bin/autojump index b1d134b..e087cc8 100755 --- a/bin/autojump +++ b/bin/autojump @@ -241,7 +241,7 @@ def match_anywhere(needles, haystack, ignore_case=False): (path="/moo/foo/baz", weight=10), (path="/foo/baz", weight=10)] """ - regex_needle = '.*' + '.*'.join(needles) + '.*' + regex_needle = '.*' + '.*'.join(needles).replace('\\', '\\\\') + '.*' regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE found = lambda haystack: re.search( regex_needle, @@ -285,7 +285,7 @@ def match_consecutive(needles, haystack, ignore_case=False): regex_no_sep_end = regex_no_sep + '$' regex_one_sep = regex_no_sep + sep + regex_no_sep # can't use compiled regex because of flags - regex_needle = regex_one_sep.join(needles) + regex_no_sep_end + regex_needle = regex_one_sep.join(needles).replace('\\', '\\\\') + regex_no_sep_end regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE found = lambda entry: re.search( regex_needle,