I'm trying to validate an url without domain, just the path and params.
The regular expression that I'm using do most of the work, but It has some errors that I dont know how to prevent (I'm pretty noob with regexp):
/^(\/([\w#!:.?+=&%@!\-\/])+)$/i
The next example are correctly validated
/asd.jsp -> true
/asd/asd.jsp -> true
/asd/asd.jsp?bar=baz&inga=42&quux -> true
/asd/asd.jsp?bar=ba z&inga=42&quux -> false
But this ones arent correct ulrs and them gives me true too:
/asd/asd./jsp -> true :(
/asd/asd.jsp/ -> true :(
/asd./asd.jsp -> true :(
/asd///asd.jsp -> true :(
/asd/asd.jsp&bar=baz?inga=42?quux -> true :(
Do you recommend to use a function instead of a regex?
Very much thanks!