jamadden / mrab-regex-hg

Automatically exported from code.google.com/p/mrab-regex-hg
0 stars 2 forks source link

escape function bug #129

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The regex.escape function does not handle properly non-unicode input with 
special_only=True.

I found the bug on line 327 of regex.py:

is:

        if special_only:
            for c in pattern:
                if c in ALNUM:
                    s.append("\\")
                    s.append(c)
should be:

        if special_only:
            for c in pattern:
                if c in NONLITERAL:
                    s.append("\\")
                    s.append(c)

Original issue reported on code.google.com by alakozik...@gmail.com on 3 Dec 2014 at 10:48

GoogleCodeExporter commented 9 years ago
What version of regex are you using? It doesn't look like a recent one.

Original comment by re...@mrabarnett.plus.com on 3 Dec 2014 at 8:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I updated to the newest version and the problem seems to be fixed. Thanks a lot!

Original comment by alakozik...@gmail.com on 9 Dec 2014 at 7:44

GoogleCodeExporter commented 9 years ago

Original comment by re...@mrabarnett.plus.com on 9 Dec 2014 at 8:31