re question - finiding matching ()

Samuel Walters swalters_usenet at yahoo.com
Sun Jan 18 22:44:49 EST 2004


| Paul Rubin said |

> miki.tebeka at zoran.com (Miki Tebeka) writes:
>> 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)"), 
> 
> You can't do that with classic regexps.  You need a parser, not a scanner.

Or, to put it slightly differently:

Regexps are a type of system that is not mathematically powerful enough to
handle this type of identification.  The next step up in power are
parsers.

Sam Walters.

-- 
Never forget the halloween documents.
http://www.opensource.org/halloween/
""" Where will Microsoft try to drag you today?
    Do you really want to go there?"""




More information about the Python-list mailing list