I have arrived at a regex for file path that has these conditions,
- Must match regex
^(\\\\[^\\]+\\[^\\]+|https?://[^/]+)
, so either something like \server\share (optionally followed by one or more "\folder"s), or an HTTP(S) URL - Cannot contain any invalid path name chars( ",<,>, |)
How can i get a single regex to use in angular.js that meets these conditions
To introduce the second condition in your regex, you mainly just have to include the invalid characters in the negated character sets, e. g. instead of
[^/]
use[^/"<>|]
.Here's a working example with a slightly rearranged regex: