Text Processingflags: gi
Non-Capturing Group (Image URL)
Use non-capturing groups `(?:...)` to alternate without polluting the captured-groups list.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
(?:https?:\/\/)\S+\.(?:jpg|jpeg|png|gif|webp|svg) (flags: gi)Raw source: (?:https?:\/\/)\S+\.(?:jpg|jpeg|png|gif|webp|svg)
How it works
(?:https?:\/\/) groups the protocol options without capturing them — useful when you only care about matching, not extracting. \S+ matches the non-whitespace URL body. \.(?:jpg|jpeg|png|gif|webp|svg) matches the dot and extension via another non-capturing group. The pattern has zero capture groups; switch to `(...)` if you need to extract pieces.
Examples
Input
Logo at https://example.com/logo.png and https://cdn.io/img.svgMatches
https://example.com/logo.pnghttps://cdn.io/img.svg
Input
http://insecure.test/photo.JPEGMatches
http://insecure.test/photo.JPEG
Input
ftp://old/asset.pngNo match
—Common use cases
- •Cleaner regex that avoids stray groups
- •Performance-sensitive matching (capturing has cost)
- •Refactoring patterns where you don't need the group's value
- •Building composable regex fragments