Didn't notice the interesting bit :). Extended to handle AABCCCCAD:
use strict; use warnings; my $string = 'WXYYZAABCCCCADWWXYYYZAAbCCCCAd'; print $1, "\n" while $string =~ m/( ([\w])(?=\2).(?!\2)(.) # Match AAB (?!\2|\3)(.) # C \4{3} # CCC \2 # A (?!\2|\3|\4). # D )/xg;
Prints:
AABCCCCAD AAbCCCCAd
In reply to Re: Backreferences in negated character classes
by GrandFather
in thread Backreferences in negated character classes
by bobf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |