Assuming you mean it when you say "no need to be valid," swampyankee's ($year, $month, $day) = split(/[.\-\/]/, $date, 3) is nice enough and can be even simpler: ($year, $month, $day) = split(/\D+/, $date, 3). For MySQL I've used =~ /\A(\d{4})\D*(\d{2})\D*(\d{2})/ which works on 2008-03-25 as well as 20080325 (a format used in certain date fields in older versions, IIRC).
For parsing arbitrary date text (in English anyway) there is Date::Manip (ParseDateString and ParseDate).
In reply to Re: Regexp for date
by Your Mother
in thread Regexp for date
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |