File & Path
File Extension
Captures the file extension from a filename.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\.([A-Za-z0-9]+)$Raw source: \.([A-Za-z0-9]+)$
How it works
`\.` matches the literal dot. `([A-Za-z0-9]+)$` captures alphanumeric characters up to the end of the string.
Examples
Input
document.pdfMatches
.pdf
Input
archive.tar.gzMatches
.gz
Input
no-extensionNo match
—Common use cases
- •File filters
- •MIME type detection
- •Upload validation
Related patterns
Image File Extension
File & PathMatch common image file extensions: jpg, jpeg, png, gif, webp, svg, avif, bmp, ico, tif, tiff.
Video File Extension
File & PathMatch common video file extensions: mp4, mov, avi, mkv, webm, m4v, flv, wmv, mpg, mpeg.
Windows File Path
File & PathMatches absolute Windows file paths (e.g., C:\Users\file.txt).
Unix File Path
File & PathMatches absolute Unix/Linux file paths.