in reply to Re^2: How to start regexp from a X position
in thread How to start regexp from a X position

You can get the last match by adding .* in front of the regex.

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.

Replies are listed 'Best First'.
Re^4: How to start regexp from a X position (5.10 fregex feature)
by pkt (Initiate) on Oct 07, 2008 at 12:32 UTC

    Ohh thank moritz, Perl is amazing, i'm using 5.10 so i'll read about the new feature \K and if i have a question I'll shoot!!!

    Thank a lot