I am trying to build a regex in PHP so that
/test/randomstring1/randomstring2matches/test/randomstring1/randomstring2/matches/test/randomstring1/randomstring2/randomstring3does not match
I've come up with
/test\/(.+?)\/.*[^\/]/
It works fine for the 2 first cases but the third also matches. Could someone help me to figure out the thing that I am missing? Thanks!
'~^/test/([^/]+)/([^/]+)/?$~'