andrew4582

IsValidPath

Sep 24th, 2011
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1.         /// <summary>
  2.         /// Gets whether the specified path is a valid absolute file path.
  3.         /// </summary>
  4.         /// <param name="path">Any path. OK if null or empty.</param>
  5.         static public bool IsValidPath(string path) {
  6.             Regex r = new Regex(@"^(([a-zA-Z]\:)|(\\))(\\{1}|((\\{1})[^\\]([^/:*?<>""|]*))+)$");
  7.             return r.IsMatch(path);
  8.         }
Advertisement
Add Comment
Please, Sign In to add comment