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.Thanks. ----------------------------------------------------------- #!/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])}; __END__
If you are just going to print the day number and you have other dates in a similar format why not just use: print +(split /\s+/, $date)[2]; -- Flemming Greve Skovengaard The killer's breed or the Demon's seed, a.k.a Greven, TuxPower The glamour, the fortune, the pain, <[EMAIL PROTECTED]> Go to war again, blood is freedom's stain, 4181.33 BogoMIPS Don't you pray for my soul anymore. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
