Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Script to validate date fails

by moritz (Cardinal)
on Feb 16, 2012 at 14:59 UTC ( #954259=note: print w/replies, xml ) Need Help??


in reply to Script to validate date fails

You need to understand that [...] in a regex is a character class, which matches just a single character. If you write [1-31], it can match the digits 1, 2 or 3, but only one of them. See perlretut for details.

The best thing to do is to first validate the syntax, with something like /\d\d?-\d\d?\d\d?/, and then check the ranges in perl code later.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954259]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-10-23 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (285 votes). Check out past polls.

    Notices?