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

"Incomplete group structure" but Python has no problem with it #2218

Open
buhtz opened this issue Jan 29, 2024 · 3 comments
Open

"Incomplete group structure" but Python has no problem with it #2218

buhtz opened this issue Jan 29, 2024 · 3 comments
Labels

Comments

@buhtz
Copy link

buhtz commented Jan 29, 2024

I get the error "Incomplete group structure" when I use the following pattern ("Python") on regex101.com.

^#\+(?i:begin)_(\S+)(?:\s(.+))?

But using this pattern with Python 3.11.2 it works as expected without errors.
So what could it be?

This is the link: https://regex101.com/r/s63H0w/1

This is how it looks in Python.

Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> rex = re.compile(r'^#\+(?i:begin)_(\S+)(?:\s(.+))?')
>>> rex.match('#+begin_src python')
<re.Match object; span=(0, 18), match='#+begin_src python'>
>>> rex.match('#+begin_src python').groups()
('src', 'python')
@buhtz buhtz added the question label Jan 29, 2024
@buhtz
Copy link
Author

buhtz commented Jan 29, 2024

Might be related to #1698 ?

If it is because Python version 2 is in the back then I would suggest to rename "Python" to "Python 2" in the flavor menu.

@firasdib
Copy link
Owner

Yes, the python implementation on regex101 is very outdated, it is python 2.7... I should update the name, as you suggested, until a more recent version can be implemented.

@mangelozzi
Copy link

Hitting the same problem trying to debug a Django regex. Python 2 is deprecated, that is critical information when trying to debug a problem. Need to debug the debug tool =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@firasdib @buhtz @mangelozzi and others