[Tutor] re module- puzzling results when matching money

Alan Gauld alan.gauld at btinternet.com
Sun Aug 4 10:30:57 CEST 2013


On 04/08/13 08:45, Alex Kleider wrote:

>> sorry, my bad. I forgot to delete that backslash, I meant
>> re.findall(r"\be\b", "d e f"). Same with the other example.
>
> ..but the interesting thing is that the presence or absence of the
> spurious back slashes seems not to change the results.


It wouldn't because the backslash says treat the next character as a 
literal and if its not a metacharacter its already treated as a literal.
So the \ is effectively a non-operation in that context.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list