I trying to validate user entered string is correct relative path or not.
- It should not start with assets/
- It should not end with /
- It should not end with any file extension like .html or .php or .jpg
- It should not contain dot .
I am trying with below regex, but it is not working correctly.
^([a-z]:)*(\/*(\.*[a-z0-9]+\/)*(\.*[a-z0-9]+))
My test cases
Valid path
- sample/hello/images
- sample/hello_vid/user/data
- test/123/user_live/images
Invalid path
- assets/sample/hello/images
- sample/hello_vid/user/data/
- test/123/user_live/images/index.html
- hii/sk.123/data
- ok/bye/last.exe
