in reply to Re: getting a return code from a looping regular expression
in thread getting a return code from a looping regular expression

hmmm...code produced a syntax error for me on the while line.
@foo = ('a(b(c)d(e(f)g)h)i(j(k)l(m)n)o', 'a(b(c)d(e(f)g)h)i(j(k)l(m)n)o)'); for (@foo) { print "\'$_\' has "; while ( s/\([^()]*\)// ){} print "un" if /[()]/; print "balanced parentheses\n"; }
Just a few minor modifications.

While you can use an algorithm like this to find if a string has matches parens, you can't write a single regexp that does it. Check out this node for a bit of an explination for this.

/\/\averick