<BEGIN_TEMPT_FATE>This one will handle nested parens:</END_TEMPT_FATE>
$_ = '(($a $a hi) $a ($a) $a)'; my $re; $re = qr/\((?:(?>[^()]*)|(??{$re}))*\)/; s/($re)|\$a/$1?$1:'$b'/eg; print; __DATA__ (($a $a hi) $b ($a) $b)
Oops!
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: Re: Replacement Regex
by tachyon
in thread Replacement Regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |