Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Script to validate date fails

by toolic (Chancellor)
on Feb 16, 2012 at 16:34 UTC ( #954271=note: print w/ replies, xml ) Need Help??


in reply to Script to validate date fails

Basic debugging checklist, Tip #9: Demystify regular expressions by installing and using the CPAN module YAPE::Regex::Explain

The regular expression: (?-imsx:[1-31]-[1-12]-[1-99]) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- [1-31] any character of: '1' to '3', '1' ---------------------------------------------------------------------- - '-' ---------------------------------------------------------------------- [1-12] any character of: '1' to '1', '2' ---------------------------------------------------------------------- - '-' ---------------------------------------------------------------------- [1-99] any character of: '1' to '9', '9' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

BTW, "validate valid date" has a nice ring to it :)


Comment on Re: Script to validate date fails
Select or Download Code
Re^2: Script to validate date fails
by madhum21 (Initiate) on Feb 17, 2012 at 13:10 UTC

    Thanks all. Thanks for all the help

Re^2: Script to validate date fails
by tobyink (Abbot) on Feb 17, 2012 at 13:25 UTC

    BTW, "validate valid date" has a nice ring to it :)

    Good point. If we only need to validate valid dates, then the following should work:

    print("Enter the date in dd-mm-yy format: "); while(<STDIN>) { print("You have entered valid data\n"); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954271]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-11 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (224 votes), past polls