in reply to Shift regex search back 4 characters...
In the spirit of TIMTOWTDI, here is one way to actually move the search point back.
#!/usr/bin/perl # http://perlmonks.org/?node_id=1183627 use strict; use warnings; $_ = '222,345,222,678,222,222,543,111'; while( /222,(\d\d\d)/g ) { print "AFTER 222-$1\n"; pos($_) -= 4; # actually move back 4 characters }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shift regex search back 4 characters...
by AnomalousMonk (Archbishop) on Mar 13, 2017 at 05:47 UTC |