Joshua Colson wrote:
> I'm trying to parse a date from a file and I would like to know how to
> match a range of numbers with a regex? For example, the days of the
> month 1..31. I understand that there are numerous modules that can do
> the work for me, this is as much for my own learning as anything.
>
> -----------------------------------------------------------
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $date = "Wed Jun 7 14:27:38 2006';
>
> print $3 if $date =~ m{(Wed)\s(Jun)\s{1,2}([1..31])};
print $1 if $date =~ m{
Wed
\s
Jun
\s\s?
( [1-9] | [1-2]\d | 3[0-1] )
\s
}x;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>