fix " escaping

This commit is contained in:
Manuel Barkhau 2020-10-11 14:53:49 +00:00
parent e3067a06ea
commit 54ab1151f1

View file

@ -27,6 +27,7 @@ def format_regex(regex: str) -> str:
re.compile(regex)
tmp_regex = regex.replace(" ", r"[ ]")
tmp_regex = tmp_regex.replace('"', r'\"')
tmp_regex, _ = re.subn(r"([^\\])?\)(\?)?", "\\1)\\2\n", tmp_regex)
tmp_regex, _ = re.subn(r"([^\\])\(" , "\\1\n(" , tmp_regex)
tmp_regex, _ = re.subn(r"^\)\)" , ")\n)" , tmp_regex, flags=re.MULTILINE)