re question

Nathan Clegg nathan at islanddata.com
Fri Oct 15 20:33:55 EDT 1999


On 15-Oct-99 Cliff Crawford wrote:
> Pada Fri, 15 Oct 1999 14:26:50 -0700, Max M. Stalnaker bilang:
>>>> str=r"blah blah blah %%%important stuff to be extracted%%%more
>>>> useless junk"
>>>> import re
>>>> group=re.search(r"%%%(.+)%%%", str)
>>>> group.groups()
> ('important stuff to be extracted',)


This MUST be a minimalistic search for this to work, or the search will
eat up everything between the *first* instance of %%% and the *last*,
ignoring all in-between.


----------------------------------
Nathan Clegg
 nathan at islanddata.com






More information about the Python-list mailing list