Reputation: 3754
I'm looking for strings that end with /
but not when the string is equal to /[a-z]{2}/
(with the 2 slashes in the pattern)
To exclude the unwanted string I would use :
(?!/[a-z]{2}/)
For strings ending in a slash I'd use :
.*/$
However, my limited knowledge with regular expression doesn't allow me to combine the two patterns. How would I do this ?
This would match :
/en/contact/
This wouldn't :
/en/
Upvotes: 3
Views: 2889
Reputation: 784998
This regex should work:
^(?!.*?\/[a-z]{2}\/$).*?\/$
Online Demo
Upvotes: 1