[issue8465] Backreferences vs. escapes: a silent failure solved

2010-04-19 Thread Aaron Sherman
New submission from Aaron Sherman : I tested this under 2.6 and 3.1. Under both, the common mistake that I'm sure many others have made, and which cost me quite some time today was: re.sub(r'(foo)bar', '\1baz', 'foobar') It's obvious, I'm sure, to many reading this that the second "r" was lef

[issue8465] Backreferences vs. escapes: a silent failure solved

2010-04-20 Thread Matthew Barnett
Matthew Barnett added the comment: Octal escapes are at most 3 octal digits, so the normal way to handle "\41" + "1" is "\0411". Some languages support variable-length hex escapes of the form "\x{1B}", so we could add that and also "\o{41}" for octal. BTW, in some languages "\e" is "\x1B".

[issue8465] Backreferences vs. escapes: a silent failure solved

2010-04-20 Thread Aaron Sherman
Aaron Sherman added the comment: Matthew, thank you for replying. I still think the primary issue is the potential for confusion between single digit escapes and backreferences, and the ease with which they could be addressed, but to cover what you said: Quote: the normal way to handle "\41"

[issue8465] Backreferences vs. escapes: a silent failure solved

2010-04-21 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> pitrou nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: