This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lucretiel
Recipients Lucretiel, ezio.melotti, mrabarnett
Date 2014-03-20.18:40:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395340840.43.0.0546340493094.issue20998@psf.upfronthosting.co.za>
In-reply-to
Content
I have the following regular expression:

In [2]: regex = re.compile("ME IS \w+", re.I)

For some reason, when using `fullmatch`, it doesn't match substrings longer than 1 for the '\w+':

In [3]: regex.fullmatch("ME IS L")
Out[3]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'>

In [4]: regex.fullmatch("me is l")
Out[4]: <_sre.SRE_Match object; span=(0, 7), match='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 `match` works fine:

In [7]: regex.match("ME IS L")
Out[7]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'>

In [8]: regex.match("ME IS Lucretiel")
Out[8]: <_sre.SRE_Match object; span=(0, 15), match='ME IS Lucretiel'>

In [9]: regex.match("me is lucretiel")
Out[9]: <_sre.SRE_Match object; span=(0, 15), match='me is lucretiel'>

Additionally, using `fullmatch` WITHOUT using the `re.I` flag causes it to work:

In [10]: regex = re.compile("ME IS \w+")

In [11]: regex.fullmatch("ME IS L")
Out[11]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'>

In [12]: regex.fullmatch("ME IS Lucretiel")
Out[12]: <_sre.SRE_Match object; span=(0, 15), match='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).
History
Date User Action Args
2014-03-20 18:40:40Lucretielsetrecipients: + Lucretiel, ezio.melotti, mrabarnett
2014-03-20 18:40:40Lucretielsetmessageid: <1395340840.43.0.0546340493094.issue20998@psf.upfronthosting.co.za>
2014-03-20 18:40:40Lucretiellinkissue20998 messages
2014-03-20 18:40:40Lucretielcreate