这些是正则表达式模式,是的,您应该能够匹配正则表达式允许的任何类型的模式。
查看“lookaround”零长度断言,特别是 Negative lookahead,然后尝试如下操作:
path_patterns:
- ^\/((?!_error)(?!fubar).)*$
Regex101是测试和理解正则表达式的绝佳工具。它将解释正则表达式每个部分的影响,如下所示:
^ asserts position at start of a line
\/ matches the character / literally (case sensitive)
1st Capturing Group ((?!_error)(?!fubar).)*
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
Negative Lookahead (?!_error)
Assert that the Regex below does not match
_error matches the characters _error literally (case sensitive)
Negative Lookahead (?!fubar)
Assert that the Regex below does not match
fubar matches the characters fubar literally (case sensitive)
. matches any character (except for line terminators)
$ asserts position at the end of a line