I'm trying to compose a regex which checks the validity of a relative path. It should start with a /
and if it has anything following it, it must also end with another /
.
Examples:
/
=> valid//
=> not valid/abc
=> not valid/abc/
=> valid
I'm using the following at the moment which responds correctly for all cases except the single /
: "^\/[ A-Za-z0-9_\/]+\/"
Do I need a lookahead?