.*RegexQuick
URL Validation Regex
Regex for matching and validating HTTP/HTTPS URLs. Works in JavaScript, Python, and other languages.
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)//
0 matches
About this pattern
This regex matches HTTP and HTTPS URLs with an optional www prefix, a domain name, and optional path, query parameters, and fragment. It handles most real-world URLs including those with ports, paths, query strings, and hash fragments. The pattern requires the protocol (http:// or https://) which helps avoid false positives from strings that merely contain dots.
FAQ
Does this match URLs without http/https?
No. Requiring the protocol avoids matching random strings like "example.com" in the middle of text. If you need to match bare domains, remove the "https?://" prefix from the pattern.