[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

Vlastimil Brom report at bugs.python.org
Thu Nov 11 23:20:15 CET 2010


Vlastimil Brom <vlastimil.brom at gmail.com> added the comment:

Maybe I am missing something, but the result in regex seem ok to me:
\A is treated like A in a character set; when the test string is changed to "A b c" or in the case insensitive search the A is matched.

[\A\s]\w doesn't match the starting "a", as it is not followed by any word character:

>>> for s in [r'\A\w', r'[\A]\w', r'[\A\s]\w']: print regex.findall(s, 'A b c')
... 
['A']
[]
[' b', ' c']
>>> for s in [r'\A\w', r'(?i)[\A]\w', r'[\A\s]\w']: print regex.findall(s, 'a b c')
... 
['a']
[]
[' b', ' c']
>>> 

In the original re there seem to be a bug/limitation in this regard (\A and also \Z in character sets aren't supported in some combinations...

vbr

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2636>
_______________________________________


More information about the Python-bugs-list mailing list