in reply to Re^2: How to start regexp from a X position
in thread How to start regexp from a X position
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 |