The solution is not universal, however, as an option, you can wrap the date in a regular or own stored function. If you are dealing with MySQL, instead of the date '9-JUN-2011', you can substitute the MySQL function STR_TO_DATE() into the query, which converts a string to a date using the format specified in the second argument of the function
SELECT STR_TO_DATE('9-JUN-2011', '%d-%b-%Y'); +---------------------------------------+ | STR_TO_DATE('9-JUN-2011', '%d-%b-%Y') | +---------------------------------------+ | 2011-06-09 | +---------------------------------------+
Then you can replace the expression ('\d{1,2}-\w{3}-\d{4}') with STR_TO_DATE(\1, '%d-%b-%Y') . In the case of another database, you should look for an analogue of the function STR_TO_DATE() .
/date '(\d{1})-([AZ]{3})-(\d{4})'/gmwith replacement by $ 3- $ 2-0 $ 1, then change all the lines which has two digits in the number, and then replace the months of the words with their digital value using a simple string replacement. - zhenyab