in reply to Weird Regexes Stuff
Updated
this may help you
#!/usr/bin/perl -w use strict; use warnings; my $input = 'All the following should be acceptable: 12:00am, 5:00pm, +8:30AM. These should probably not be accepted: 3:00,2:60am, 99:00am, +3:0pm, 29:00AM.'; while ($input =~ m/\W([1-9]|[01][0-2]|2[0-3]):[0-5][0-9][ap]m/gsi) { print "This is a valid time!\t$&\n"; } __END__ OUTPUT This is a valid time! 12:00am This is a valid time! 5:00pm This is a valid time! 8:30AM
Regards,
Velusamy R.
eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Weird Regexes Stuff
by AnomalousMonk (Archbishop) on Aug 18, 2011 at 18:11 UTC | |
Re^2: Weird Regexes Stuff
by AnomalousMonk (Archbishop) on Aug 19, 2011 at 07:47 UTC |
In Section
Seekers of Perl Wisdom