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>

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

.



Relevant Pages

  • Re: Replace function and carriage returns
    ... By "second row of the destination table" do you mean the second ... immediate right of the carriage return. ... Function StripCr(ByVal sStr As String) As String ...
    (microsoft.public.word.vba.general)
  • Re: Fixed Address Function
    ... Public Function FixedAddressAs String ... 'vbCrLf Carriage return/line feed ... Dim newAddress As String ... Dim strLine As String ...
    (microsoft.public.access.queries)
  • Re: can I split a C string
    ... Actually I am writing portable code that runs on windows & ARM9. ... the string on console window(here "\r" is not ... the carriage from right to left, the designers split the task into two - ... paper up a line - so that it would require two input characters to do this ...
    (comp.lang.c)
  • RE: Replace function and carriage returns
    ... immediate right of the carriage return. ... Function StripCr(ByVal sStr As String) As String ... Dim nPos As Long ... I have a table containing formfields. ...
    (microsoft.public.word.vba.general)
  • Re: Fixed Address Function
    ... Public Function FixedAddressAs String ... 'vbCrLf Carriage return/line feed ... Dim newAddress As String ... Dim strLine As String ...
    (microsoft.public.access.queries)