shortest match regexp operator anyone?

Helmut Giese hgiese at ratiosoft.com
Wed Jul 11 14:37:33 EDT 2001


Hello Harald,
>2) TASK: Find the first '<A>' and match, if it is followed by a 'B'
>   SOLUTION: ???
I would - naivly - do it in two steps:
1) Find the first '<A>'.
2) Return a match only if it is followed immediately by 'B'.

But I concede voluntarily that this solution has two drawbacks:
1) It doesn't solve the intellectual challenge.
2) It's not a one-liner and as such not really acceptable. :)

Best regards
Helmut




More information about the Python-list mailing list