use strict; use warnings; use Test::More; my @good = ( 'Calling upgrade.sql on 05-JUL-18 10.19.42.559000 PM -12', 'Calling apply.sql on 17.10.18 12:28:12,447849 +02:' ); my @bad = ( 'foo' ); my $re = qr/\d\d\W(?:\d\d|[A-Z]{3})\W\d\d \d\d\W\d\d\W\d\d/; plan tests => @good + @bad; for my $str (@good) { like ($str, $re, "$str matched"); } for my $str (@bad) { unlike ($str, $re, "$str not matched"); }