Searching a string and extract all occurancies of a substring
- From: Nico Grubert <nicogrubert@xxxxxxxxx>
- Date: Thu, 31 Aug 2006 17:44:08 +0200
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>
The ... can contain different values. I need to extract the string between <source id="box"><parameter key="path"> and </parameter></source>.
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>
From this text I need to get a list with this:
["/www/mydoc1", "/foo/bar/doc"]
What's the best way to do this?
I'll need to use Python: 2.3.5
Thanks in advance,
Nico
.
- Prev by Date: Re: GC and security
- Next by Date: Re: Pros/Cons of Turbogears/Rails?
- Previous by thread: Re: Timeline for Python?
- Next by thread: Re: Searching a string and extract all occurancies of a substring
- Index(es):
Relevant Pages
|