Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/stringutil.py @ 38481:de275ab362cb
stringutil: update list of re-special characters to include &~
I missed this because I was looking at the change that refactored
re.escape, and these characters were added in
https://github.com/python/cpython/commit/05cb728d68a278d11466f9a6c8258d914135c96c.
Differential Revision: https://phab.mercurial-scm.org/D3850
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 27 Jun 2018 10:21:07 -0400 |
parents | 96f65bdf0bf4 |
children | a3130208db1c |
comparison
equal
deleted
inserted
replaced
38480:b4cfd803b3f2 | 38481:de275ab362cb |
---|---|
23 pycompat, | 23 pycompat, |
24 ) | 24 ) |
25 | 25 |
26 # regex special chars pulled from https://bugs.python.org/issue29995 | 26 # regex special chars pulled from https://bugs.python.org/issue29995 |
27 # which was part of Python 3.7. | 27 # which was part of Python 3.7. |
28 _respecial = pycompat.bytestr(b'()[]{}?*+-|^$\\.# \t\n\r\v\f') | 28 _respecial = pycompat.bytestr(b'()[]{}?*+-|^$\\.&~# \t\n\r\v\f') |
29 _regexescapemap = {ord(i): (b'\\' + i).decode('latin1') for i in _respecial} | 29 _regexescapemap = {ord(i): (b'\\' + i).decode('latin1') for i in _respecial} |
30 | 30 |
31 def reescape(pat): | 31 def reescape(pat): |
32 """Drop-in replacement for re.escape.""" | 32 """Drop-in replacement for re.escape.""" |
33 # NOTE: it is intentional that this works on unicodes and not | 33 # NOTE: it is intentional that this works on unicodes and not |