Back to all patterns
Open Graph Image URL
Web & Network
Matches a remote image URL suitable for Open Graph meta tags.
/^https?://[^\s"<>]+\.(?:jpe?g|png|webp|gif|svg)(?:\?[^\s"<>]*)?$/iHow it works
OG images are typically jpg/png/webp/gif/svg. Pattern allows an optional query string (for cache-busting or CDN signing) and excludes whitespace/quotes/angle brackets.
Test Cases
Should Match
- https://cdn.example.com/og.png
- https://images.example.com/cover.jpg?v=2
- https://example.com/a/b/c.svg
Should NOT Match
- /local/og.png
- https://example.com/page.html
Quick Summary
Matches a remote image URL suitable for og:image tags (jpg/png/webp/gif/svg, optional query).