in reply to RegEx: How to negate more than one character?
I think
does what you want. That technique will get awkward quickly as more excluded combinations are added.my $re = qr/(?:[^ab][^h])|(?:[^ab][h])|(?:[ab][^h])/;
Matching a longer string will nearly always succeed unless you anchor the match to some expected position or embed it in a larger expression. You may want to consider negative matching,
for detecting strings which contain no example of 'ah' or 'bh'.$string !~ /[ab]h/;
After Compline,
Zaxo
|
|---|