Problem with Regular Expressions?

Allan Crooks googlegroups at sixtyten.org
Sat May 4 16:56:15 EDT 2002


Hi,

I was wondering if anyone could tell me if what I want to do is
possible with a solitary single expression?

I have a webpage that I want to process, which contains multiple
<table>'s. I want to find a particular table, which will contains a
particular word. I want to be able to return each row in the table.

The regular expression would probably have to match the entire table,
with grouping needing to be used to capture each row.

Only problem is that I'm not sure if it's possible to return every row
that was captured within a group. As far as I can see, using findall()
would return all the tables which matched the expression, but I
wouldn't be able to find everything which matched a particular group.

I can probably write a RE which would match the table I want, and then
take the text that was matched, and then use another RE to extract all
the rows. Question is, can this all be done in one go?

Sorry if I'm bad at explaining what I mean, I shouldn't listen to
music at the same time as typing. :)

Thanks,
Allan.



More information about the Python-list mailing list