Rob Dixon schreef:
> Dr.Ruud:
>> Michael Alipio:

>>> $log  = "date=2007-01-12 blah blah";
>>> [...]
>>>     ($date) = $log =~
>>>     /date=(\S+?)[\s+|,]/;
>>
>>       /date=([0-9]{4}-[0-9]{2}-[0-9]{2})\b/;
>>
>>       /date=([0-9]{4}(?:-[0-9]{2}){2})\b/;
>>
>>       /date=([0-9-]{10})\b/;
>>
>>       /date=([0-9-]+)\b/;
>>
>> (untested)
>
> Why would you not test the code you posted?

No time.


> $log =~ /date=([\d-]+)/;
>
> will do what is required here.

I prefer [0-9] to \d, and to have that \b in there. Why didn't you ask
why? :)

Your "required" is not mine, I prefer to test the full lay out of a date
(see my 1st and 2nd alternative), unless specifically asked not to.

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to