正则表达式匹配月份名称,后跟年份

前端之家收集整理的这篇文章主要介绍了正则表达式匹配月份名称,后跟年份前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
例如,可以使用正则表达式来匹配“2009年2月”吗?
沿线
\b(?:Jan(?:uary)?|Feb(?:ruary)?|...|Dec(?:ember)?) (?:19[7-9]\d|2\d{3})(?=\D|$)

那是

\b                  # a word boundary
(?:                 # non-capturing group
  Jan(?:uary)?      # Jan(uary)
  |Feb(?:ruary)?    #
  |...              # and so on
  |Dec(?:ember)?    # Dec(ember)
)                   # end group
                    # a space
(?:                 # non-capturing group
  19[7-9]\d|2\d{3}  # 1970-2999
)                   # end group
(?=\D|$)            # followed by: anything but a digit or the end of string
原文链接:https://www.f2er.com/regex/357091.html

猜你在找的正则表达式相关文章