in reply to Replace character not inside comments

I couldn't come up with a regex to catch those, but only one that would catch all other chars(as long as comments don't nest). I think you could use the following:
$test=q|\AFZ\BJK \*\AFZ...*\ |; $new.=$1 while $test=~/([^\\]|\\\*.*?\*\\)/g;
UPDATE: Or, if comments do nest perhaps this will do:
$test=q|\AFZ\BJK \*\A\*F*\Z...*\ |; $comment=qr/\\\*(?:[^\\]*|\\[^*]|(??{$comment}))*?\*\\/; $new.=$1 while $test=~/([^\\]|$comment)/g;