perlee has asked for the wisdom of the Perl Monks concerning the following question:
I just got tired of trying to know my code isnt working. Need ur help.
This is what I have : to match the date in 10-01-08 format.However the loop never enters again in case of a wrong input.do { print "Enter Date. For Ex: 10-01-08 \n"; chomp($date = <STDIN>); } while ($date =~ /0[1-9]|1[0-2]-0[1-9]|1[0-9]|2[0-9]|3[0-1]-0[8-9]|1[ +0-9]/);
I have also tried (for simplicity)
On 10-01-08..Loop is not entered again (fine)#while ($date !~ /(\d\d)[-](\d\d)[-](\d\d)/);
What is that I am missing..
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression for date
by moritz (Cardinal) on Aug 25, 2008 at 07:59 UTC | |
|
Re: Regular expression for date
by Skeeve (Parson) on Aug 25, 2008 at 07:56 UTC | |
|
Re: Regular expression for date
by fmerges (Chaplain) on Aug 25, 2008 at 09:45 UTC | |
|
Re: Regular expression for date
by Grey Fox (Chaplain) on Aug 25, 2008 at 13:02 UTC | |
|
Re: Regular expression for date
by didess (Sexton) on Aug 25, 2008 at 20:47 UTC | |
by didess (Sexton) on Aug 25, 2008 at 21:11 UTC |