我需要一個或多個正則表達式來匹配某個網站的某些無效url,在某個模式之後OR前有大寫字母。正則表達式匹配大寫字母包圍的字符串模式
這些都是結構規則相匹配的無效網址:
- 定義網站
- 零或多個大寫字母,如果該模式之後零個大寫字母
- 模式
- 零,或更多大寫字母,如果模式之前爲零大寫字母
要用實例s:
http://website/uppeRcase/pattern/upperCase // match it, uppercase before and after pattern
http://otherweb/WhatevercAse/pattern/whatevercase // do not match, no website
http://website/lowercase/pattern/lowercase // do not match, no uppercase before or after pattern
http://website/lowercase/pattern/uppercasE // match it, uppercase after pattern
http://website/Uppercase/pattern/lowercase // match it, uppercase before pattern
http://website/WhatevercAse/asdasd/whatEveRcase // do not match it, no pattern
在此先感謝您的幫助!
馬里奧
該網站是一個網站,如「myintranet.mycompany.com」,該模式是一個常見的文件夾名稱,如「上傳」 – Mario 2010-10-20 20:34:14
URL的路徑組件可以區分大小寫。主機名不是。 – novalis 2010-10-20 20:44:13
@novalis,經過深思熟慮並編輯。 – Brad 2010-10-20 20:49:07