Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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?
[LanX]: ha ... just read an article saying that some US presidents in the past lost their nuclear codes
[LanX]: xD
[Corion]: The code is 00000000, as always, no?
[GotToBTru]: I remember hearing about somebody misplacing a list of code phrases or something

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-01-20 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.