[issue13899] re pattern r"[\A]" should work like "A" but matches nothing. Ditto B and Z.

Ezio Melotti report at bugs.python.org
Sat Jan 28 23:42:34 CET 2012


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

This happens because \A, \B and \Z are valid escape sequences[0].
If what you mean is that they shouldn't be recognized as such inside a character class, then I can agree with that.
^ and $ are similar to \A and \Z but they are considered as literals inside [].  I think the same could also be applied to \b and \B, unless you expect r'[\b]' to match the same as r'\b'.

(On an unrelated note, it's preferable to avoid using ints as flag -- using re.DEBUG is better)

[0]: http://docs.python.org/library/re.html#regular-expression-syntax

----------
nosy: +ezio.melotti, mrabarnett

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


More information about the Python-bugs-list mailing list