escapes in regular expressions

James Thiele jamesthiele.usenet at gmail.com
Sun May 21 13:49:36 EDT 2006


I was helping a guy at work with regular expressions and found
something I didn't expect:

>>> re.match('\d', '7').group()
'7'
>>> re.match('\\d', '7').group()
'7'
>>>

It's not clear to me why these are the same. Could someone please
explain?




More information about the Python-list mailing list