I currently have a dataset with varying date entries (and a mixture of string entries) for which I need to parse. There are a few: `'M/DD/YY'`, `'M/D/YY'`, `'MM/DD/YY'`, `'MM/D/YY'`, `'MM/DD/YYYY'`...). I could use some support with improving my regex to handle the varying formats and possible text entered in the date field.

My current Postgres query breaks out other entries into another column and reformats the date. Although, I've increased the year to 4 digits rather than 2, I believe the issue may live somewhere in the `'YYYY-MM-DD'` formatting or that my query does not properly accommodate additional formatting within.

```
CASE WHEN date ~ '^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$' THEN TO_DATE(date::date, 'YYYY-MM-DD')
     ELSE NULL END AS x_date,

CASE WHEN NOT date ~ '^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$' AND date <> '' THEN date
     ELSE NULL END AS x_date_text

```

For the various date formats, they should be reformatted accordingly and for other non-date values, they should be moved over to the other column.