/\b\d{1,2} de [a-z]+ (de 1\d{3}|del 2\d{3})/i
解释:
\b ... requires a word boundary, since the following character is a digit
(and thus a word character) this will only match if the date is
preceded by a character that is not a letter, not a digit and
not an underscore
\d{1,2} ... one or two digits
de ... literally "de"
[a-z]+ ... any letter from a-z, at least once but an arbitrary number of times
(de 1\d{3} ... literally "de" followed by "1" and 3 more digits
| ... or
del 2\d{3}) ... literally "del" followed by "2" and 3 more digits
i ... make the whole thing case-insensitive (you can omit this if needed)
另请注意,正则表达式中的所有空格都被视为与任何其他字符一样。
或者,[a-z]+
您可以指定一个有效月份列表,例如
/\b\d{1,2} de (...|septiembre|...) (de 1\d{3}|del 2\d{3})/i
(用更多的月份名称替换 ...|
以将它们分开)