in reply to Regex matching on grid alignment
If keeping regexes simple is one of your objectives, then another strategy would be to match all and then discard mis-aligned matches.
use strict; use warnings; my $str = 'AAA451BBB512CCC123DDD234EEE345FFF45'; while( $str =~ /((.)\2\2)/g ) { next unless $-[1] % 5 < 3; print "Found $1\n"; }
|
|---|