I have a list that looks like this:
['','2022-03-31', 'euss', 'projects','2021-03-31']
I want to write a regular expression such that I delete all other items from the list and only keep those that have a date format. For example, 2022-03-31 and 2021-03-31.
I tried this but it doesn't seem to make a difference when I print my list out:
my_list = [re.sub(r"(\d+)/(\d+)/(\d+)",r"\3-\1-\2",i) for i in list(my_list) ]