I need help to create a regex (for JavaScript .match and PHP preg_match) that validates a unix type absolute path to a file (with international characters such as åäöøæð and so on) so that:
- /path/to/someWhere is valid
- /path/tø/sömewhere is valid
- /path/to//somewhere is invalid
- path/to/somewhere is invalid
- /path/to/somewhere/ is invalid
The regex needs to handle paths regardless of their depth (/path/to or /path/to/somewhere or /path/to/somewhere/else)
I have a regexp that marks 1 to 3 as valid /^\/.+[^\/]$/ , the problem is to make this regex not to mark 3 as valid as it contains // without any other character in between.