Devtools.supstudio.in

Tools/Regex

URL

What this is

URL matching is messy (userinfo, IPv6 hosts, brackets). This pattern is for 'find links in text', not for parsing. For parsing use the URL constructor.

/https?:\/\/[^\s/$.?#].[^\s]*/gi
See https://devtools.supstudio.in/regex and http://example.com/a?x=1
not a link

Open in tester

FAQ

Why not RFC 3986?
A complete URI regex is unreadable and still wrong at the edges. Prefer new URL(string).

Related