use strict; use warnings; use Test::More tests => 4; my $re = qr{(?=.*?\d)(?=.*[a-zA-Z])}; for (qw(abc123 123abc)){ like $_, $re; } for (qw(123 abc)){ unlike $_, $re; }