I am quite new to regular expression and I want that in my regular expression it should accept only \\
(double back slash ) and not \
(single back slash).
isFilePathValid: function (get) {
var forbiddenCharactersRegexp = /[<>|?*]/,
directorySeparatorsRegexp = /[/\\]/,
directorySeparatorsRegexp1 = /[\\{2}]/,
filePath = get('filePath').trim();
return directorySeparatorsRegexp.test(filePath)
&&
!directorySeparatorsRegexp.test(filePath.charAt(filePath.length - 1))
&& !forbiddenCharactersRegexp.test(filePath) &&
directorySeparatorsRegexp1.test(filePath) ;
}
the correct file paths are 1. \\abc 2. C:\abd 3. C:\abd\abc