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
Related patterns
Named Capture Group (Date)
Text ProcessingDemonstrate named capture groups by extracting year/month/day from ISO-style dates.
Non-ASCII Character
Text ProcessingMatch runs of non-ASCII characters (anything outside U+0000–U+007F).
Lazy / Non-Greedy Quantifier
Text ProcessingDemonstrate lazy quantifiers `+?` by matching the SHORTEST HTML-like tag rather than the longest greedy span.
Markdown Image
Text ProcessingMatches Markdown image syntax .