equal
deleted
inserted
replaced
26 |
26 |
27 # regex special chars pulled from https://bugs.python.org/issue29995 |
27 # regex special chars pulled from https://bugs.python.org/issue29995 |
28 # which was part of Python 3.7. |
28 # which was part of Python 3.7. |
29 _respecial = pycompat.bytestr(b'()[]{}?*+-|^$\\.&~# \t\n\r\v\f') |
29 _respecial = pycompat.bytestr(b'()[]{}?*+-|^$\\.&~# \t\n\r\v\f') |
30 _regexescapemap = {ord(i): (b'\\' + i).decode('latin1') for i in _respecial} |
30 _regexescapemap = {ord(i): (b'\\' + i).decode('latin1') for i in _respecial} |
|
31 regexbytesescapemap = {i: (b'\\' + i) for i in _respecial} |
31 |
32 |
32 def reescape(pat): |
33 def reescape(pat): |
33 """Drop-in replacement for re.escape.""" |
34 """Drop-in replacement for re.escape.""" |
34 # NOTE: it is intentional that this works on unicodes and not |
35 # NOTE: it is intentional that this works on unicodes and not |
35 # bytes, as it's only possible to do the escaping with |
36 # bytes, as it's only possible to do the escaping with |