小编Jac*_*sen的帖子

包含一个字符串但不包含另一个字符串的字符串的正则表达式

在我们的项目中使用正则表达式来匹配包含字符串“/pdf/”的任何 url:

(.+)/pdf/.+
Run Code Online (Sandbox Code Playgroud)

需要修改它,以便它不会匹配也包含“help”的网址

例子:

不应匹配:“/dealer/help/us/en/pdf/simple.pdf” 应匹配:“/dealer/us/en/pdf/simple.pdf”

regex regex-negation regex-lookarounds

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

regex ×1

regex-lookarounds ×1

regex-negation ×1