Regex: How to validate that a path does not contain //

zchocolatemoose

New Member
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 ?????e 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 invalidThe 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.
 
Top