Finding matched parentheses

Thierry Douez th.douez at gmail.com
Tue Jul 30 07:08:25 EDT 2013


2013/7/29 Geoff Canyon <gcanyon at gmail.com>

> On Mon, Jul 29, 2013 at 12:14 PM, Peter Haworth <pete at lcsql.com> wrote:
>
> > Personally, I'd use the regex that Thierry posted a couple of days back.
> >  No recursion involved and one line of code does the job.
> >
>
>
> If you're talking about:
>
> matchChunk(mystring,"(\([^)]*\)).*",tstart,tEnd)
>
> That will return 1,4 for the string "((()))"
>


​which is the correct answer.

This one line of code is a straight answer to the 1st post of this thread
where no-one speaks about nested parentheses!

If you change the rules afterwards, then it's another story and
different answers..

I like this sentence picked up from Mark's pointer:

    "I would go with something that works on sane things
         than weep about not being universally perfect :-)  "

Best,

Thierry

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage



More information about the use-livecode mailing list