use strict; use warnings; use Test::More; my @good = ( 'http:// S ', 'We will all go to http:// SSSSSSSS ', ); my @bad = ( 'foo', 'http:// foo ', 'https:// SSS ', 'http:// SSS', 'http://SSS ', 'HTTP:// SSS ', 'http:// SSS ', "http://\tSSS ", "http:// SSS\t", ); my $re = qr{http:// (S+) }; plan tests => @good + @bad; for my $str (@good) { like ($str, $re, "$str matched"); } for my $str (@bad) { unlike ($str, $re, "$str not matched"); }