When does the escape character work within raw strings?
walterbyrd at iname.com
Wed May 20 19:38:18 CEST 2009
I know that
s = r'x\nx'
means 'x' followed by a literal '\' followed by an 'n' (the '\n' is
not a carriage return).
s = r'x\tx'
means 'x' followed by a literal '\' followed by an 't' (the '\t' is
not a tab).
But, boundries seem to work differently.
s = re.sub(r'\bxxx\b', 'yyy', s)
Is *not* going to look for a literal '\' followed by 'b'
So I am confused about when escapes work within raw strings, and when
do escapes not work within raw strings.
More information about the Python-list