0

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

thanks

JP

1

2 Answers 2

1

Try

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

10char

Sign up to request clarification or add additional context in comments.

1 Comment

(l)? can just be written l?
0

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

1 Comment

thanks.. this is more generic than what i needed. I was unable to get the exact syntax for (w3c/)? (was using extra \).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.