簡體   English   中英

正則表達式-不包含字符串,也不以/結尾

[英]Regex - Not containing a string and not ending with a /

如何創建不包含字符串“ umbraco”且不以/結尾的正則表達式

這是我到目前為止所擁有的,但是我無法使其完全正常工作,我們將不勝感激。

(?!umbraco)(?![/]$)

測試字符串為:

應該是這個正則表達式:

^(?!.*?umbraco).*?[^\/]$

在線演示: http//regex101.com/r/lM0cS9

說明:

^ 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

這應該是正則表達式

^(?!.*?umbraco).*?[^\/\s*\n*]$

演示http://rubular.com/r/tEhY7JFjXK

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM