Regular Expressions

Diez B. Roggisch deetsNOSPAM at web.de
Tue Apr 27 08:15:32 EDT 2004


..:: sjf ::.. wrote:
> Thanks. And now, let's assume that I have a following strings:
> S1 = "B - TYPE2: any_text_2 TYPE3: any_text_23"
> S2 = "C - TYPE2: any_text_3"
> 
> and I want to have one regular expression that produce only following
> data: ("B", "any_text_2")
> ("C", "any_text_3")
> that is, any characters starting TYPE3 till end will be omitted.
> How do make this?

r"(.) TYPE. : ([^ ]*)"

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list