Pattern library/URL / link regex

URL / link regex

Useful for crawlers, log cleaning, and chat scrapers when you need a quick URL pull without a full HTML parser.

This pattern favors http(s) absolute links; open Forge if you also need www-only or markdown links.

Expression

/https?:\/\/[^\s"'<>\u4e00-\u9fff\u3000-\u303f\uff00-\uffef]+(?<![.,;:!?])/gi

How to read it

  • https?http or https
  • :\/\/Scheme separator
  • [^\s"'<>…]+(?<![.,;:])URL body; no CJK / trailing punctuation

Sample test

2 match(es)
See https://example.com/a?x=1 and http://news.cn/path. Ignore example.com without a scheme.

Starter prompt: match http and https URLs in text