我想匹配日期格式爲(月dd,yyyy)的字符串中的日期。當我在下面使用我的正則表達式模式時,我感到困惑。它只匹配以日期開頭的字符串。我錯過了什麼?日期正則表達式python
>>> p = re.compile('[A-z]{3}\s{1,}\d{1,2}[,]\s{1,}\d{4}')
>>> s = "xyz Dec 31, 2013 - Jan 4, 2014"
>>> print p.match(s).start()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'start'
>>> s = "Dec 31, 2013 - Jan 4, 2014"
>>> print p.match(s).start()
0 #Correct