[tpm] I wish I was better at regex's
uri at StemSystems.com
Wed Mar 9 13:14:30 PST 2011
>>>>> "RJ" == Rob Janes <janes.rob at gmail.com> writes:
RJ> i recall some compsci proof that regex cannot do nested pattern
RJ> matching, like (xxx) or (xxx (yyy) zzz). for that you need a lalr
RJ> parser, something like recdescent or whatever.
that is true for pure regexes. perl's latest can match nested pairs. it
isn't trivial but the feature is in there and documented. regardless,
this problem is very easy to solve with text::balanced and some basic
code. just a single regex is the wrong solution.
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the toronto-pm