开发者

PHP Regex for file/path

开发者 https://www.devze.com 2023-02-01 18:21 出处:网络
What would be the php regex to match any one of the following: privacy.html pri开发者_如何学运维vacy.htm

What would be the php regex to match any one of the following:

privacy.html
pri开发者_如何学运维vacy.htm
privacy
w3c/privacy.html
w3c/privacy.htm
w3c/privacy

thanks

JP


Try

(w3c/)?privacy(.htm(l)?)?

10char


This should work: ^[^\/]+(?:\/[^\/]+)?$

0

精彩评论

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