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
fullmatch isn't matching correctly under re.IGNORECASE #65197
Comments
I have the following regular expression: In [2]: regex = re.compile("ME IS \w+", re.I) For some reason, when using In [3]: regex.fullmatch("ME IS L") In [4]: regex.fullmatch("me is l") In [5]: regex.fullmatch("ME IS Lucretiel") In [6]: regex.fullmatch("me is lucretiel") I have no idea why this is happening. Using In [7]: regex.match("ME IS L") In [8]: regex.match("ME IS Lucretiel") In [9]: regex.match("me is lucretiel") Additionally, using In [10]: regex = re.compile("ME IS \w+") In [11]: regex.fullmatch("ME IS L") In [12]: regex.fullmatch("ME IS Lucretiel") My platform is Ubuntu 12.04, using Python 3.4 installed from Felix Krull's deadsnakes PPA (https://launchpad.net/~fkrull/+archive/deadsnakes). |
Here is a patch. |
FWIW, here's my own attempt at a patch. |
Both patch are almost equivalent (my patch is much simpler but perhaps Unfortunately Rietvield doesn't work with Matthew's patch, so I have added my
Why this check is not needed anymore?
state->match_all);
state->match_all is used but it is never initialized. |
After stepping through the code for that regex that fails, I concluded
I thought I'd initialised it in all the places it's used. I admit that I find the code a little hard to follow at times... :-( |
fullmatch() is not yet implemented on the regex scanner object SRE_Scanner (bpo-21002). Is it possible to adapt this patch to fix this omission? |
Tests are passed without this check. But I'm not sure it is not needed. At
Indeed, it is initialized in Modules/_sre.c, and it is always 0. Perhaps it |
Gareth, this is unrelated issue. |
New changeset 6267428afbdb by Serhiy Storchaka in branch '3.4': New changeset bcf64c1c92f6 by Serhiy Storchaka in branch 'default': |
Thank you Matthew for your contribution. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: