If you use perl 5.10.0 or newer, you can make use of the \K ("keep") assertion:
use 5.010; my $str = '<1> <2> <3>'; $str =~ s/.*\K<\d>/<4>/; say $str; __END__ <1> <2> <4>
If you want to add test after the match, you can use s/.*<\d>\K/ <4>/ instead.
In reply to Re^3: How to start regexp from a X position (5.10 regex feature)
by moritz
in thread How to start regexp from a X position
by pkt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |