How to get the "longest possible" match with Python's RE module?
tim.peters at gmail.com
Tue Sep 12 07:16:27 CEST 2006
> I want to know if there is some way to make Python RE behave like grep
Not in general, no. The matching strategies couldn't be more
different, and that's both deep and intentional. See Friedl's book
> or do I have to change to another engine?
Yes, if POSIX regexp semantics are what you require. Several years
ago there was an extension module for Python supplying POSIX
semantics, but I couldn't find anything current just now in a minute
of searching. You may be more motivated to search longer ;-)
More information about the Python-list