Nico, perhaps this would be suitable:
>>> s = '''Example text:
This is a test. <link url="/www/folder" target="_self" title=""> A test.
<source id="box"><parameter key="path">/www/mydoc1</parameter></source>
And I need to extraxt /www/mydoc1 and /www/mydoc2 from this text.
<source id="box"><parameter key="path">/foo/bar/doc</parameter></source> ...'''
>>> import SE
>>> Thing_Filter = SE.SE ('<EAT> "~<source id="box"><parameter
>>> key="path">(.|\n)*?</parameter></source>~==" | "~<.*?>~= " ')
>>> print Thing_Filter (s).split ()
['/www/mydoc1', '/foo/bar/doc']
If you expect more than one of these sections and need a list of records, it
would take no more than an additional split.
You'd find SE here: http://cheeseshop.python.org/pypi/SE/2.2%20beta
Regards
Frederic
----- Original Message -----
From: "Nico Grubert" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, August 31, 2006 5:44 PM
Subject: Searching a string and extract all occurancies of a substring
> Hi there,
>
> in a text with no carriage returns I need to look for all occurancies of
> this string:
>
> <source id="box"><parameter key="path">...</parameter></source>
>
etc.
--
http://mail.python.org/mailman/listinfo/python-list