Skip to main content
AllDevToolsHub
Back to all patterns

Windows Drive Letter Path

File & Path

Matches the prefix of a Windows drive-letter absolute path (C:\... or C:/...).

/^[A-Za-z]:[\\/]/

How it works

Detects an absolute Windows path by drive letter, allowing either backslash or forward slash separator. Useful for cross-platform path normalization.

Test Cases

Should Match

  • C:\Users\Bob
  • D:/projects/repo
  • z:\\unc?

Should NOT Match

  • /etc/passwd
  • Users/Bob
  • :C\

Quick Summary

Matches the leading drive-letter portion of a Windows absolute path.