如何创建不包含字符串“ umbraco”且不以/结尾的正则表达式
这是我到目前为止所拥有的,但是我无法使其完全正常运行,我们将不胜感激。
(?!umbraco)(?![/]$)
测试字符串为:
应该是这个正则表达式:
^(?!.*?umbraco).*?[^\/]$
解释:
^ assert position at start of a line
(?!.*?umbraco) Negative Lookahead - Assert that it is impossible to match the regex below
.*? matches any character (except newline)
Quantifier: Between zero and unlimited times, as few times as possible, expanding as needed
umbraco matches the characters umbraco literally (case sensitive)
.*? matches any character (except newline)
Quantifier: Between zero and unlimited times, as few times as possible, expanding as needed
[^\/] match a single character not present in the list below
\/ matches the character / literally
$ assert position at end of a line
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句