regex help for a newbie

marco marco at reimeika.ca
Tue Apr 6 02:19:32 EDT 2004


Marco Herrn <herrn at gmx.net> writes:

> I have the following string in my program:
> 
>   string= "aaa%(BBB%(CCC)BBB)aaa%(DDD)aaa"

[snip]

> the parts in a recursive function. So the thing I want to achieve here
> is to extract %(BBB%(CCC)BBB) and %(DDD).

p1, p2 = "aaa%(BBB%(CCC)BBB)aaa%(DDD)aaa".split("aaa")[1:-1]

Cheers,

--
marco at reimeika.ca
Gunnm: Broken Angel                      http://amv.reimeika.ca
http://reimeika.ca/                      http://photo.reimeika.ca



More information about the Python-list mailing list