I have this code:
if(/^\/[^/]+\/[^/]+\/collections/.test(location.pathname)) { alert("ok")};
This match with:
http://localhost:3000/es/hyperrjas/collections
The problem is that also match with:
http://localhost:3000/es/hyperrjas/collections/thing1
http://localhost:3000/es/hyperrjas/collections/thing2
http://localhost:3000/es/hyperrjas/collections/thing3
.
.
.
I need only match with the first type url:
http://localhost:3000/es/hyperrjas/collections
http://localhost:3000/es/michael-25/collections
http://localhost:3000/es/other_username/collections
I don't want match the urls with thing1, thing2, thing3....etc
How can I fix this regex javascript?