所以我是新來的正則表達式,並試圖寫一個正則表達式將匹配這樣的:正則表達式 - 禁止某些字符串
example.com/some-url-text-here/
而不是像
example.com/some-url-text/but-also-more-than-two-slashes/
example.com/text-here/one-slash-too-many/two-slashes-too-many/
基本上,我想它匹配一個網址,其中包含一些不超過兩個/
的string-separated-by-dashes
。
我嘗試了幾個不同的東西像negative look around或not ....我想最後一件事情是這樣的:
example\.com/[a-zA-z]*-*/
[a-zA-z]*-*
匹配類似text-here
,但我不能讓它匹配/text-here/
。在這種情況下我做錯了什麼?
哦......這是我的一個愚蠢的錯誤。謝謝澄清! – ocean800