[docs] [issue13899] re pattern r"[\A]" should work like "A" but matches nothing. Ditto B and Z.
report at bugs.python.org
Sun Jan 29 22:41:11 CET 2012
John Machin <sjmachin at lexicon.net> added the comment:
@Ezio: Comparison of the behaviour of \letter inside/outside character classes is irrelevant. The rules for inside can be expressed simply as:
1. Letters dDsSwW are special; they represent categories as documented, and do in fact have a similar meaning outside character classes.
2. Otherwise normal Python rules for backslash escapes in string literals should be followed. This means automatically that \a -> \x07, \A -> A, \b -> backspace, \B -> B, \z -> z and \Z -> Z.
@Georg: No need to read the source, just read my initial posting: It's compiled as a zero-length matcher ("at") inside a character class ("in") i.e. a nonsense, then at runtime the illegality is deliberately ignored.
Python tracker <report at bugs.python.org>
More information about the docs