473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

Aug 31 '06 #1
0 1434

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: rdraider | last post by:
Is there a function that will extract part of a string when the data you want does not occur in a specific position? Field "REF" is varchar(80) and contains an email subject line and the email...
8
by: yerk5 | last post by:
Does js have some way of doing what I want here: I want to paste a multiline block of text into a TEXTAREA form field, and there is data in the block of text that I want to extract into a...
17
by: Olivier Bellemare | last post by:
I've tried to make a function that returns the middle of a string. For example: strmid("this is a text",6,4); would return "is a". Here is my code: char *strmid(char *texte, int depart,...
9
by: Sharon | last post by:
hi, I want to extract a string from a file, if the file is like this: 1 This is the string 2 3 4 how could I extract the string, starting from the 10th position (i.e. "T") and...
4
by: Rhonda Tipton | last post by:
Hello. I am trying to do a substring or something like that to extract the middle portion of a string. 12345 TEST FACILITY 1_Letter 1A 12346 TEST FACILITY 2_Letter 1A I would like to be...
1
by: Patrick Sullivan | last post by:
I am trying to extract two parts of a number from an array element. Numbers are in the format of 1.10, 2.50, 11.10, etc. Floor and ceiling won't work right because close to 1.00, I get a zero, and...
2
by: Badass Scotsman | last post by:
Hello, Using VB and ASP,NET I would like to be able to search a STRING for a smaller STRING within, based on the characters which appear before and after. For example: String1 = " That was...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
7
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.