Re: matching date




Dr.Ruud wrote:
joez311@xxxxxxxxx schreef:

Can someone help me out with the following pattern match? I want to
match on the date went its formated like mm/dd/yy. I was trying:
/[0,1][0-9]/[0-3][0-9]/[0-9[0-9]/
but my match doesn't seam to work as expected. I think its because of
the / used to split the feilds. Could some one show me the correct way
to pattern match on this?
Thanks,
Zim


I see a comma that probably shouldn't be there, and a missing "]", and
unescaped slashes, which leads to:

m~[01][0-9]/[0-3][0-9]/[0-9][0-9]~


one issue with the OP's regex (even after it's been "corrected") is
that it matches months 13 - 19, and days 32 - 39 (and also day 31 for
months that don't have that particular day).



Check out Regexp::Common
http://search.cpan.org/search?module=Regexp::Common

.



Relevant Pages

  • Re: matching date
    ... match on the date went its formated like mm/dd/yy. ... but my match doesn't seam to work as expected. ... That was the main reason for this advice: ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)
  • Re: matching date
    ... joez311@xxxxxxxxx schreef: ... match on the date went its formated like mm/dd/yy. ... but my match doesn't seam to work as expected. ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)