Michael A. Peters wrote:
This is what I have so far - $pattern[] = "/^([0-9]{1,2})[\s-]([A-Z][a-z]*)[\s-]([0-9]{4,4})$/i"; $clean[] = "\\3-\\2-\\1"; $pattern[] = "/^([A-Z][a-z]*)[\s-]([0-9]{4,4})$/"; $clean[] = "\\2-\\1-01"; $foo = preg_replace($pattern, $clean, $verb_date);
If I were you, I'd write several regexes, one for each date format you wish to recognize. It makes the regexes much easier to read, and you can still write sub-expressions for catching e.g. months and then reuse those in your main regexes.
/Per Jessen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php