File & Path
Unix File Path
Matches absolute Unix/Linux file paths.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
^(/[^/\0]+)+/?$Raw source: ^(/[^/\0]+)+/?$
How it works
`^(/[^/\0]+)+` matches one or more path segments beginning with `/`, excluding null and additional slashes within segments. `/?$` allows optional trailing slash.
Examples
Input
/home/user/documentsMatches
/home/user/documents
Input
/var/log/Matches
/var/log/
Input
relative/pathNo match
—Common use cases
- •Path validation
- •File system tools
- •Shell scripting
Related patterns
Windows File Path
File & PathMatches absolute Windows file paths (e.g., C:\Users\file.txt).
Relative Path
File & PathMatches relative file paths (./, ../, or path/to/file).
File Extension
File & PathCaptures the file extension from a filename.
Hidden File (Dotfile)
File & PathMatches Unix-style hidden files (dotfiles) like .gitignore or .env.