I am trying to use regular expressions to remove some weirdly formatted dates from a column.
Then coalesce:
select coalesce(
try_to_date($1,'YY-MON-DD')
, try_to_date($1,'YYYY-MM-DD')
, try_to_date($1,'YYYY-MM-DD HH:MI:SS')
, try_to_date($1,'YYYYMMDD')
) fixed
, $1 original
from values('20-APR-30'),('20-FEB-25'),('2021-12-01'),('2021-12-10 00:00:00'),('20211210')
;