URL & Web Address Regex

Validate and extract HTTP/HTTPS website links, subdomains, port numbers, query strings, and path parameters.

//gi
Valid: https://example.com, https://sub.domain.org/path?q=123#hash Invalid: ftp://invalid, http://, www.example.com

Regex Cheatsheet

COMMON PATTERNS
SYNTAX REFERENCE
TOOLS FOR WRITING BETTER CODE
JetBrains All Products Pack
IDEs with built-in regex debugging, refactoring, and inspections.
Try free โ†’
Regex course on Udemy
Go from this cheatsheet to writing complex patterns confidently.
View course โ†’
DigitalOcean / hosting credit
Deploy the scripts you are testing patterns for.
Get credit โ†’
Affiliate disclosure: links above may earn us a commission โ€” this never affects the calculation results above.

Common Use Cases for URL & Web Address Regex

User Profile Website Links

Verify personal website and social media profile URLs on user registration.

Web Scraping & Link Crawlers

Extract valid HTTP/HTTPS URLs from raw HTML responses.

Frequently Asked Questions

Does this require http:// or https://?

Yes, this pattern enforces standard http:// or https:// protocols.