use strict; use warnings; use Test::More; my @good = ( '"18/02/2018"', '"""18/02/2018"' ); my @bad = ( '""18/02/2018"' ); my $re = qr/^"("")?[^"]/; plan tests => @good + @bad; for my $str (@good) { like ($str, $re, "$str matched"); } for my $str (@bad) { unlike ($str, $re, "$str not matched"); }