regular expression help

goldtech goldtech at
Tue Nov 30 06:17:16 CET 2010


>>> import re
>>>> m="oooocccvlvlvlvnnnflfllffccclfnnnooo"
>>> re.compile(r'ccc.*nnn')
>>> rtt=pppp.sub("||",m)
>>> rtt

The regex is eating up too much. What I want is every non-overlapping
occurrence I think.

so rtt would be:


just like findall acts but in this case I want sub to act like that.


More information about the Python-list mailing list