![](/img/trans.png)
[英]How to check if a number starts with Special Characters using regular expression
[英]How to validate Starts with and Not Starts using Regular Expression?
我希望找到一種方法來組合兩個滿足以下條件的正則表達式:
對於第一種情況,我認為這可行:'^ / home /'
我不確定第二種情況的正則表達式應該是什么。
如果支持,可以實施負前瞻。
^/home/(?!index).*$
說明:
^ # the beginning of the string
/home/ # '/home/'
(?! # look ahead to see if there is not:
index # 'index'
) # end of look-ahead
.* # any character except \n (0 or more times)
$ # before an optional \n, and the end of the string
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.