Regex - File Path - Drive letter paths

Check whether a string looks like a valid path to a folder or file on the Microsoft Windows operating system.

Drive letter paths

^[a-z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$

NOTE: Case insensitive.


\A
[a-z]:\\                    # Drive
(?:[^\\/:*?"<>|\r\n]+\\)*   # Folder
[^\\/:*?"<>|\r\n]*          # File
\Z

NOTE: Free-spacing, case insensitive.