in reply to Replace character not inside comments
UPDATE: Or, if comments do nest perhaps this will do:$test=q|\AFZ\BJK \*\AFZ...*\ |; $new.=$1 while $test=~/([^\\]|\\\*.*?\*\\)/g;
$test=q|\AFZ\BJK \*\A\*F*\Z...*\ |; $comment=qr/\\\*(?:[^\\]*|\\[^*]|(??{$comment}))*?\*\\/; $new.=$1 while $test=~/([^\\]|$comment)/g;
|
|---|