my $re = qr/(?:a|b)h/; print 'abcdef' !~ $re; print 'ahcdef' !~ $re; print 'abbhef !~ $re; #### 1 (0) (0)