← Back to Blog

Regex to Match URLs: HTTP, HTTPS, and More

Regex patterns for matching URLs: simple HTTP/HTTPS matching, full URL validation with path and query, and domain extraction.

Simple URL Regex

https?:\/\/[^\s/$.?#].[^\s]*

URL with Path, Query, Fragment

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)

Test these patterns in our Regex Tester.

Try It Free

Use our free online tool — 100% client-side, no data leaves your browser.

Open Regex Tester

Related Tools & Articles