Reputation: 13
I want to catched the "asd06/05/04" and "06/05/04". I am using for
m/[a-zA-Z]*[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]|[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]/
for this question.
if($word =~ "m/[a-zA-Z]*[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]|[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]/"){
print "$word => catched";}
else{
print "$word => not catched\n";
}
How can I do that.
Thank you.
Upvotes: 0
Views: 117
Reputation: 1550
I think your regular expression is a bit complicated, Try this:
$word = "asd06/05/04";
if( $word =~ /(\w+)?\d{2}\/\d{2}\/\d{2}/ ){
print "$word => catched \n";
} else{
print "$word => not catched\n";
}
Upvotes: 4