From b597d00e5ccdb1a594957f46f315b08b8cecb16f Mon Sep 17 00:00:00 2001 From: york Date: Sat, 2 Jan 2021 21:07:11 +0800 Subject: [PATCH] re.escape(os.sep) because on windows os.sep is \ and need escape --- bin/autojump_match.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/autojump_match.py b/bin/autojump_match.py index 8747b90..76083ad 100644 --- a/bin/autojump_match.py +++ b/bin/autojump_match.py @@ -75,7 +75,7 @@ def match_consecutive(needles, haystack, ignore_case=False): (path='/foo/baz', weight=10), ] """ - regex_no_sep = '[^' + os.sep + ']*' + regex_no_sep = '[^' + re.escape(os.sep) + ']*' regex_no_sep_end = regex_no_sep + '$' regex_one_sep = regex_no_sep + os.sep + regex_no_sep regex_needle = regex_one_sep.join(imap(re.escape, needles)) + regex_no_sep_end