Re: [Tutor] re module- puzzling results when matching money
Hi, not quite. The moral is to learn about greedy and non-greedy matching ;)! -nik Alex Kleider schrieb: >On 2013-08-03 13:38, Dominik George wrote: >> Hi, >> >> b is defined as all non-word characters, so it is the complement oft >> w. w is [A-Za-z0-9_-], so b includes $ and thus cuts off your >> group. >> >> -nik > >I get it now. I was using it before the '$' to define the beginning of > >a word but I think things are failing because it detects an end of >word. >Anyway, the moral is not to use it with anything but \w! > >Thanks! -- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] re module- puzzling results when matching money
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/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor