PHP Regex for file/path

后端 未结 2 1641
清酒与你
清酒与你 2021-01-28 03:28

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

privacy.html
privacy.htm
privacy
w3c/privacy.html
w3c/privacy.htm
w3c/privacy

th

相关标签:
2条回答
  • 2021-01-28 04:07

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

    0 讨论(0)
  • 2021-01-28 04:08

    Try

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

    10char

    0 讨论(0)
提交回复
热议问题