Regex101
Regex101 copied to clipboard
"Incomplete group structure" but Python has no problem with it
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')
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.
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.
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 =)