use Regexp::Common;
use strict;
my @examples = (
'${ThisOne}',
'do not match me %{}',
'${This${One}}',
'${This${One}Too}',
'${This${One}and${also}this}',
'me either $}',
'dont match this line noise {} $ }{'
);
foreach (@examples){
print "$_\n" if /(\$$RE{balanced}{-parens=>'{}'})/;
}
my $longstring = join "", @examples;
print "\n", join ("\n",
$longstring =~ /(\$$RE{balanced}{-parens=>'{}'})/g);
__OUTPUT__
${ThisOne}
${This${One}}
${This${One}Too}
${This${One}and${also}this}
${ThisOne}
${This${One}}
${This${One}Too}
${This${One}and${also}this}
flounder |