Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
> is this XML, or just something that looks a little like XML ? Unfortunately, something that looks a little XML so I can't use a XML parser. But the HTML parser does the job. -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Anthra Norell
ditional 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: Sent: Thursday, August 31, 2006 5:44 PM Subject: Searching a string and extract all oc

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Fredrik Lundh
Nico Grubert wrote: > in a text with no carriage returns I need to look for all occurancies of > this string: > > ... > > The ... can contain different values. I need to extract the string > between and . is this XML, or just something that looks a little like XML ? -- http://mail.python

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
> This works as long as there are no other Tags in the content > that I parse. Got it. I forgot to handle the 'attrs' parameter in handle_starttag(). Changed it to: def handle_starttag(self, tag, attrs): if tag == 'parameter': if attrs == [('key', 'infobox_path')]:

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
> Try Beautiful Soup, or if your input is simple enough, the re module. Hi Gabriel, I first tried "HTMLParser" and wrote this short script: from HTMLParser import HTMLParser from htmlentitydefs import entitydefs class MyDocParser(HTMLParser): def __init__(self): self.paths = []

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Gabriel Genellina
At Thursday 31/8/2006 12:44, Nico Grubert wrote: in a text with no carriage returns I need to look for all occurancies of this string: ... Try Beautiful Soup, or if your input is simple enough, the re module. Gabriel Genellina Softlab SRL

Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
Hi there, in a text with no carriage returns I need to look for all occurancies of this string: ... The ... can contain different values. I need to extract the string between and . Example text: This is a test. A test. /www/mydoc1 And I need to extraxt /www/mydoc1 and /www/mydoc2 from thi