File & Pathflags: i
Image File Extension
Match common image file extensions: jpg, jpeg, png, gif, webp, svg, avif, bmp, ico, tif, tiff.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\.(jpe?g|png|gif|webp|svg|avif|bmp|ico|tiff?)$ (flags: i)Raw source: \.(jpe?g|png|gif|webp|svg|avif|bmp|ico|tiff?)$
How it works
\. matches the literal dot. The alternation group covers all common web and raster image extensions. jpe?g covers both jpg and jpeg. tiff? covers tif and tiff. The i flag makes matching case-insensitive so .PNG and .JPG also match.
Examples
Input
photo.jpegMatches
.jpeg
Input
logo.SVGMatches
.SVG
Input
document.pdfNo match
—Common use cases
- •File upload type validation
- •Build pipeline asset filtering
- •Media library ingestion scripts
- •CDN cache-policy rule generation
Related patterns
Video File Extension
File & PathMatch common video file extensions: mp4, mov, avi, mkv, webm, m4v, flv, wmv, mpg, mpeg.
File Extension
File & PathCaptures the file extension from a filename.
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.