--- On Tue, 11/30/10, goldtech <goldt...@worldpost.com> wrote: > From: goldtech <goldt...@worldpost.com> > Subject: regular expression help > To: python-list@python.org > 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