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]*/giSee https://devtools.supstudio.in/regex and http://example.com/a?x=1 not a link
FAQ
- Why not RFC 3986?
- A complete URI regex is unreadable and still wrong at the edges. Prefer new URL(string).