英文日期格式的正则匹配:

1、美式:

((January|February|March|April|May|June|July|August|September|October|November|December)|((Jan|Feb|Mar|Apr|Aug|Sept|Oct|Nov|Dec)(\.?)))( ?)(\d+)((st|nd|rd|th)?),( ?)(\d{2,})

2、英式:

(\d+)((st|nd|rd|th)?)(,?)( ?)((January|February|March|April|May|June|July|August|September|October|November|December)|((Jan|Feb|Mar|Apr|Aug|Sept|Oct|Nov|Dec)(\.?))),( ?)(\d{2,})

两者的却别在与美式日期格式为月 日,年,而英式日期格式为日,月, 年或者日 月,年。

上述正则匹配的日期格式有:(所有空格可有可无)

March 9, 2017

March 9th, 2017

9, March, 2017

9, March, 2017

9th, March, 2017

9th, March, 2017

上述英文日期在去除9号后面的th后,可以在C#程序中使用以下语句进行转换:

DateTime dt = Convert.ToDateTime("9 March, 2017");