Finding matched parentheses

Peter Haworth pete at lcsql.com
Fri Jul 26 12:03:18 EDT 2013


On Thu, Jul 25, 2013 at 7:38 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:

> I think this is closer to what you're looking for
>
> get matchChunk(pString,"(\(.*\)).*",tstart,tEnd)
>
> but even that will fail when you have multiple parentheses in strings
> like this:
>
> "hello (bucko) this (is) a test"
>

OK, I thought the OP was looking to find the position of the closing paren
(which mine does), not the positions of the opening and closing parens
(Which yours does).  But you're right, neither one deals with multiple
pairs of parens.  I'll bet there's a regex for it though!

Might be a good idea for the OP to clarify a bit more about what he's
trying to do.  There might not be multiple pairs of parens in his scenario,
for example.

Pete
lcSQL Software <http://www.lcsql.com>



More information about the use-livecode mailing list