开发者

regex match urls NOT containing given set of strings

开发者 https://www.devze.com 2023-04-06 16:09 出处:网络
I need to match all urls that DO NOT contain either /admin/ or开发者_JS百科 ?page=. I\'ll be using this as a redirect rule in an iirf.ini file (supports htaccess syntax).

I need to match all urls that DO NOT contain either /admin/ or开发者_JS百科 ?page=.

I'll be using this as a redirect rule in an iirf.ini file (supports htaccess syntax).

How can I accomplish this?


Use a negative look-ahead (?!...) with a regex OR (a|b):

^(?!.*(/admin/|\?page=))

This is saying that when positioned at the start (^) the input should contain either of your two test strings

0

精彩评论

暂无评论...
验证码 换一张
取 消