I'm not a regex expert and I'm breaking my head trying to do one that seems very simple and works in python 2.7: validate the path of an URL (no hostname) without the query string. In other words, a string that starts with /, allows alphanumeric values and doesn't allow any other special chars except these: /, ., -
I found this post that is very similar to what I need but for me isn't working at all, I can test with for example aaa and it will return true even if it doesn't start with /.
The current regex that I have kinda working is this one:
[^/+a-zA-Z0-9.-]
but it doesn't work with paths that don't start with /. For example:
/aaa-> true, this is ok/aaa/bbb-> true, this is ok/aaa?q=x-> false, this is okaaa-> true, this is NOT ok
