On 12/17/2009 7:59 PM, Rhodri James wrote:
"re.compile('a\\nc')" passes a sequence of four characters to re.compile: 'a', '\', 'n' and 'c'. re.compile() then does it's own interpretation: 'a' passes through as is, '\' flags an escape which combined with 'n' produces the newline character (0x0a), and 'c' passes through as is.
I got that from MRAB's posts. (Thanks.) What I'm not getting is why the replacement string gets this particular interpretation. What is the payoff? (Contrast e.g. Vim's substitution syntax.) Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list