Regular Expressions

..:: sjf ::.. sjf at autograf.pl
Tue Apr 27 09:17:50 EDT 2004


pewnego dnia niejaki Diez B. Roggisch deetsNOSPAM at web.de wstukał był ;-)
> ..:: 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. : ([^ ]*)"

it works as long as any_text_2 and any_text_3 _not_ contains spaces, but in
my files these contain spaces and then this regexp cuts any_text_2 (and
any_text_3) after first space :((


-- 
.:: sjf ::..
"Linux is like Wigwam. No gates, no windows... Apache inside ;-)"



More information about the Python-list mailing list