RegexWars
Tier 6 · Adeptextract

Every Link In The Blob

Extract every http and https URL from a block of text, and nothing else that looks like a scheme.

A URL runs until the next space. \S is "not whitespace", which is a lazier and shorter way of saying "the rest of the link" than trying to enumerate what a URL may contain.

Your pattern1 chars · par 13
//g
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases
  • see https://example.com and http://foo.dev/bar→ ["https://example.com", "http://foo.dev/bar"]
  • no links here→ []
  • http://localhost:3241/c/every-url→ ["http://localhost:3241/c/every-url"]
  • ftp://old.server/file then https://new.server/file→ ["https://new.server/file"]

    ftp is not http

+ 4 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.