We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c113611 commit 03fe27fCopy full SHA for 03fe27f
python-stdlib/fnmatch/fnmatch.py
@@ -27,8 +27,6 @@ def normcase(s):
27
28
__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"]
29
30
-COMPAT = re.__name__ == "ure"
31
-
32
33
def fnmatch(name, pat):
34
"""Test whether FILENAME matches PATTERN.
@@ -58,12 +56,18 @@ def _compile_pattern(pat):
58
56
res = bytes(res_str, "ISO-8859-1")
59
57
else:
60
res = translate(pat)
61
- if COMPAT:
+
+ try:
+ ptn = re.compile(res)
62
+ except ValueError:
63
+ # re1.5 doesn't support all regex features
64
if res.startswith("(?ms)"):
65
res = res[5:]
66
if res.endswith("\\Z"):
67
res = res[:-2] + "$"
- return re.compile(res).match
68
69
70
+ return ptn.match
71
72
73
def filter(names, pat):
0 commit comments