--- On Tue, 11/30/10, goldtech <[email protected]> wrote:
> From: goldtech <[email protected]>
> Subject: regular expression help
> To: [email protected]
> Date: Tuesday, November 30, 2010, 9:17 AM
> The regex is eating up too much. What I want is every
> non-overlapping
> occurrence I think.
>
> so rtt would be:
>
> 'oooo||flfllff||ooo'
>
Hi, I'll just let Python do most of the talk here.
>>> import re
>>> m="oooocccvlvlvlvnnnflfllffccclfnnnooo"
>>> p=re.compile(r'ccc.*?nnn')
>>> p.sub("||", m)
'oooo||flfllff||ooo'
Cheers,
Yingjie
--
http://mail.python.org/mailman/listinfo/python-list