re question - finiding matching ()

Miki Tebeka miki.tebeka at zoran.com
Sun Jan 18 16:51:38 CET 2004


Hello All,

To all of you regexp gurus out there...

I'd like to find all of the sub strings in the form "add(.*)"
The catch is that I might have () in the string (e.g. "add((2 * 2), 100)"), 

Currently I can only get the "addr((2 *2)" using re.compile("\w+\([^\)]*\)"). 
To solve the problem a hand crafted search is used :-(

Is there a better way?

Thanks.
Miki



More information about the Python-list mailing list