[tpm] I wish I was better at regex's
J. Bobby Lopez
jbl at jbldata.com
Wed Mar 9 13:19:11 PST 2011
I would expect that you can just count the number of ';' instances in the
string, and get the index of the last instance which resides after the last
instance of the last single or double quote. If there are no quotes, then
it's the first instance of ';'.
On Wed, Mar 9, 2011 at 4:14 PM, Uri Guttman <uri at stemsystems.com> wrote:
> >>>>> "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
>
> --
> Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com--
> ----- Perl Code Review , Architecture, Development, Training, Support
> ------
> --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com---------
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20110309/2dee6fec/attachment-0001.html>
More information about the toronto-pm
mailing list