You used "(?<!a)" and "(?!b)" as anchors, so your solution was designed to match a substring, but it doesn't work for 'a_abb' (false negative) and 'a_abbb' (false positive).
for (qw[ ab abb abbb aabb aabbb aabbbb a_abb a_abbb ]) { m[ (?<!a) (?> (a+) (?{ length($^N) }) (b+) ) (?(?{ length($^N)-$^R != 1 })(?!)) ]x and print("$_\n"); }
abb aabbb a_abb
In reply to Re^2: Integrating match counts into regex matching
by ikegami
in thread Integrating match counts into regex matching
by pat_mc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |