can I use regex for this?

From: Date: Wed, 29 May 2002 04:43:34 +0000
Subject: can I use regex for this?
Groups: php.general 
Request: Send a blank email to php-general+get-99626@lists.php.net to get a copy of this message
I have a string which is a date - eg "01-JUL-02" I want to convert the month bit to it's corresponding number, so the above would become "01-07-02" Can this easily be done using a regex? Otherwise I was thinking of this: $mon = array("JAN"=>"01", "FEB"=>"02", "MAR"=>"03", etc...); list($x, $y, $z) = explode("-", $date); $date = $x."-".$mon[$y]."-".$z; A bit dodgy, but if I have to....

« previous php.general (#99626) next »