in reply to Re^2: search for matching parentheses
in thread search for matching parentheses

It seems to work like this:

use Text::Balanced qw(extract_bracketed); my $string = "Param1(x,y,z), Param2(1,2,3), Param3(a,b,c)"; print "Original string: ", $string, "\n"; my ($ext,$rem,$pre) = extract_bracketed($string, '()', '[^(]*'); print "extracted: $ext\n"; print "remainder: $rem\n"; print "prefix: $pre\n";

All I've really changed is the prefix regex. I'm now saying that the prefix is one or more non-bracket characters. I'm a little confused tho' - I'd expect that to be the default behaviour.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg