New submission from Nathan West: 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). ---------- components: Regular Expressions messages: 214257 nosy: Lucretiel, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: fullmatch isn't matching correctly under re.IGNORECASE versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20998> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com