print "Please enter the string ";
chomp($string=<STDIN>);
$regex= "^\d{4,4}[A-Z0-9]$ ";
if ($string =~ m!($regex)!g)
{
print 'match';
print "$regex";
}
else
{
print 'no match';
print "$regex";
}
It matches the regex in this case but when the input is a text file it fails to recognize any patterns
|