Regular Expressions

Diez B. Roggisch deetsNOSPAM at web.de
Mon Apr 26 09:38:04 EDT 2004


> <FONT COLOR="#FF0000">A - TYPE1: any_text<BR>
> B - TYPE2: any_text_2<BR>
> C - TYPE2: any_text_3<BR>
> w - any_text_15<BR>
> </FONT>
> html code
> </BODY></HTML>
> 
> I need to have only following data:
> (B, any_text_2)
> (C, any_text_3)
> that is, these data TYPE2 in which.

you should utilize the htmlparser class to extract the text first. Then this
regular expression might help:

r"(.) TYPE. : (.*)"

 
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list