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.
--
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.
--
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.
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 anyth
On Wed, 2006-06-07 at 16:20 -0600, Jeremy Vinding wrote:
> Joshua Colson wrote:
> >
> > print $3 if $date =~ m{(Wed)\s(Jun)\s{1,2}([1..31])};
> >
> I believe you'd have to use alternation.
>
> for example, something like:
> /(0?[1-9]|[12][0-9]|3[01])/
> or
> /([012]?[1-9]|[1-3]0|31)/
That does
On Wed, 2006-06-07 at 15:55 -0700, John W. Krahn wrote:
> print $1 if $date =~ m{
> Wed
> \s
> Jun
> \s\s?
> ( [1-9] | [1-2]\d | 3[0-1] )
> \s
> }x;
>
On Thu, 2006-06-08 at 00:55 +0200, Flemming Greve Skovengaard wrote:
> 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];
Well, in this particular instance, I am. However, there have been at
least a f
Joshua Colson schreef:
> 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 an
Joshua Colson wrote:
> On Wed, 2006-06-07 at 16:20 -0600, Jeremy Vinding wrote:
>>Joshua Colson wrote:
>>>print $3 if $date =~ m{(Wed)\s(Jun)\s{1,2}([1..31])};
>>>
>>I believe you'd have to use alternation.
>>
>>for example, something like:
>>/(0?[1-9]|[12][0-9]|3[01])/
>>or
>>/([012]?[1-9]|[1-3]0|
You can simply split on whitespace.
http://perl-e.chovy.com/sample/date-parse
On 6/7/06, Joshua Colson <[EMAIL PROTECTED]> 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
Joshua Colson wrote:
On Thu, 2006-06-08 at 00:55 +0200, Flemming Greve Skovengaard wrote:
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];
Well, in this particular instance, I am. However, there have
11 matches
Mail list logo