11
Answers

Regex validation for relative paths

David Smith

David Smith

11y
3.1k
1
Below I am using this regex below to validate relative paths. The regex string below do not accept this as a valid path. Can someone help me.

"..\\..\\Bin\\Example.xml"  Error, not recognized as a path according to the regex below.



string regExp = @"^(?:[A-Za-z]\:|\\)(\\[a-zA-Z_\-\s0-9\.]+)+(\.\w+)?$";

Answers (11)