Windows File Path Regular Expression

A regular expression to match the path of a file in Windows.

/^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/

Windows File Path Examples:

  • C:\\Users\\Administrator\\Desktop\\chrome.link
  • E:\\m\\vscode.exe

See Also:

Regex Is Copied!