my $s = 'foo|foo|foo'; my $p = do { $s =~ /foo/g; pos $s }; $s =~ s/foo/pos $s >= $p ? 'bar' : 'foo'/ge; print "$s\n";
In reply to Re: Regex match and replace
by choroba
in thread Regex match and replace
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |