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