我在日志中看到一个清除请求转到表格的清漆
req.url ~ "^(.*)(?<!\\d{1})534328(?!\\d{1})"
。我不确定正则表达式到底匹配的是什么。我知道varnish使用POSIX正则表达式。我正在尝试为正则表达式^(.*)(?<!\\d{1})534328(?!\\d{1})
生成示例匹配,但无法使用一个工具来帮助我。
编辑:抱歉,根据changelog here.
,我犯了一个错误The regular expression engine is now PCRE instead of POSIX regular expressions.
答案 0 :(得分:2)
它匹配534328
,既不是前面也不后面是数字。
^ # line beginning
(.*) # any character repeated any number of times, including 0
(?<!\d{1}) # negative look-behind assertion: single digit
534328 # literal 534328
(?!\d{1}) # negative look-ahead assertion: single digit
"whatever 534328" ← match
"wharrgarbl 1534328" ← no match
"any chars 5343289" ← no match
"hello world a534328b" ← match