← Back to all regex patterns
Extraction
Low backtracking risk

Regex to Extract URLs

A pragmatic URL extractor for logs, markdown drafts, and support transcripts where you want to capture obvious HTTP and HTTPS links.

Regex
/https?:\/\/[^\s"'<>]+/gi

Try this pattern

Matches current input
Docs live at https://tinapps.com/list/regex

1 match found in the current text.

Passing examples

  • Docs live at https://tinapps.com/list/regex
  • Visit http://localhost:3000/test

Failing examples

  • No link here
  • ftp://legacy.example.com

Code examples

JavaScript
const regex = /https?:\/\/[^\s"'<>]+/gi;
regex.test(input);
Python
import re
pattern = re.compile(r"https?:\/\/[^\s"'<>]+", re.IGNORECASE)
bool(pattern.search(input))
Go
re := regexp.MustCompile("(?i)https?:\\/\\/[^\\s\"'<>]+")
matched := re.MatchString(input)

Related Extraction Patterns