在负数后面添加一个数字:
(?<!月|\d)\d+日(?!后)
It's fairly easy. You only have to guarantee, that the match is not preceded by a digit.
(?<!月|\d)\d+日(?!后)
------^^^
This adds contrast to your RegEx. See RexEgg for details
As you are using Negative look behind, you should be on EcmaScript2018.
You should put a word boundary \\b
before \\d
in your regex to avoid it matching partially and then it will stop matching your first line. Try this regex,
(?<!月)\b\d+日(?!后)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.