mercurial/utils/stringutil.py
changeset 40684 e6c9ef5e11a0
parent 40276 be57c7019c70
child 43076 2372284d9457
equal deleted inserted replaced
40683:d7936a9dad47 40684:e6c9ef5e11a0
    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