从文本文件中的文本中检测日期。然后使用 python 列出它们

Detect the dates from text in text file. And then list them out using python

我有一个文本文件,其中包含文本中的日期。这些日期的格式为("march 2016" 或 "march 2, 2016")。我想把它们列出来。有人可以帮我解决这个问题吗?

这是我的尝试

import re 
regex = '\s(\w+)\s(\d+\,)\s(\d+)' # this will match the form "str int, int" with open('./BACKGROUND OF THE SOLICITATION3.txt', 'r') as f: 
   text = f.read() 
all_dates = [' '.join(date) for date in re.findall(regex, text)] 
print all_dates
s = " I want to detect both March 20, 2013 and February 2013 3 and list them"

import  re

print(re.findall(r"([A-Z][a-z\s\d]+, \d+|[A-Z][a-z\s]+\d+)",s))
['March 20,2013', 'February 2013']