Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Script to validate date fails

by toolic (Bishop)
on Feb 16, 2012 at 16:34 UTC ( [id://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 :)

Replies are listed 'Best First'.
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 (Canon) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://954271]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-03-19 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found