2

我有两个字符串:

s1 = 'Agreement dated on March 9, 2007'
s2 = 'Agreement signed on March 9, 2007'

我在字符串上运行以下代码

import datefinder
matches =datefinder.find_dates(s1) ## or s2
for match in matches:
       print (match)

s2给了我想要的结果,但s1没有,因为它包含过时的词。

PS我使用过datefinder,因为我有多种日期格式,因此需要编写多个正则表达式。这仅适用于此异常

知道为什么会出现这种奇怪的行为吗?

4

0 回答 0