Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re.error in raw escape string marked succeed #48

Open
sarnold opened this issue Sep 7, 2024 · 0 comments
Open

re.error in raw escape string marked succeed #48

sarnold opened this issue Sep 7, 2024 · 0 comments

Comments

@sarnold
Copy link

sarnold commented Sep 7, 2024

This is "new" behavior as of py311, possibly earlier. Behavior is the same with built-in re.

$ python
Python 3.11.9 (main, May 26 2024, 09:54:30) [GCC 13.2.1 20240503] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re2 as re
>>> obj = re.compile(r'(?<!\\\):(.*?)(?<!\\\):')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "compile.pxi", line 6, in re2.compile
  File "compile.pxi", line 96, in re2._compile
  File "pattern.pxi", line 607, in re2.PythonRePattern.__init__
  File "/usr/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 989, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 464, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 779, in _parse
    p = _parse_sub(source, state, verbose, nested + 1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 464, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 784, in _parse
    raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 14
>>> obj = re.compile(r'(?<!\\):(.*?)(?<!\\):')
>>> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant