1
0
mirror of https://github.com/wting/autojump synced 2024-09-28 22:10:45 +00:00

windows "re" but

windows path like '\'   need other  '\'  escape
This commit is contained in:
晓鹏 2020-12-18 19:22:11 +08:00 committed by GitHub
parent 06e082c918
commit 7e3f4b67fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ def match_consecutive(needles, haystack, ignore_case=False):
(path='/foo/baz', weight=10), (path='/foo/baz', weight=10),
] ]
""" """
regex_no_sep = '[^' + os.sep + ']*' regex_no_sep = '[^\\' + os.sep + ']*'
regex_no_sep_end = regex_no_sep + '$' regex_no_sep_end = regex_no_sep + '$'
regex_one_sep = regex_no_sep + os.sep + 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 regex_needle = regex_one_sep.join(imap(re.escape, needles)) + regex_no_sep_end