1.1 --- a/moinformat/parsers/common.py Sat Jul 28 12:49:22 2018 +0200
1.2 +++ b/moinformat/parsers/common.py Sun Jul 29 00:19:30 2018 +0200
1.3 @@ -65,6 +65,12 @@
1.4 return "%s{%s,%s}" % (s, min is not None and min or "",
1.5 max is not None and max or "")
1.6
1.7 +def get_pattern(s):
1.8 +
1.9 + "Return a compiled regular expression for the given pattern 's'."
1.10 +
1.11 + return re.compile(s, re.UNICODE | re.MULTILINE)
1.12 +
1.13 def get_patterns(syntax):
1.14
1.15 """
1.16 @@ -77,7 +83,7 @@
1.17 for name, value in syntax.items():
1.18 value = value.replace(r"\N", ws_excl_nl)
1.19 value = value.replace(r"\Q", quotes)
1.20 - patterns[name] = re.compile(value, re.UNICODE | re.MULTILINE)
1.21 + patterns[name] = get_pattern(value)
1.22 return patterns
1.23
1.24 def get_subset(d, keys):