URL Regex Validator & Pattern
Validate URLs with regex patterns supporting http/https, FTP, query parameters, fragments, international domains IDN, and localhost.
URL Validator
Regular Expression
Sample URLs
https://example.comhttps://www.example.com/path/to/pagehttps://example.com?query=value&foo=barhttps://example.com#sectionhttp://sub.example.com/path?q=1#hashftp://files.example.comexample.comnot a urlhttp://https://example.com/very/long/path/with/many/segments?key=value&another=test#fragmentWhat is URL Regex Validator & Pattern?
URL Regex Validator offers robust regular expression patterns for validating Uniform Resource Locators URLs according to RFC 3986 with practical real-world compatibility. Validating URLs correctly via regex is surprisingly challenging URLs can contain multiple subdomains blog dot example dot co dot uk ports colon eight zero eight zero colon three thousand complex query strings with URL-encoded parameters and multiple key-value pairs fragment identifiers hash section two international domain names with non-Latin characters Chinese dot com converted via Punycode to xn--fiq228c dot com IPv4 addresses one ninety two dot one six eight dot one dot one and IPv6 addresses in square brackets bracket colon colon one bracket plus authentication credentials in legacy format user colon pass at host. Many common URL regex patterns fail to handle these cases or over-match invalid strings. This tool provides three tuned patterns a Strict pattern requires protocol validates TLD list a Practical pattern what most production apps should use allows localhost and intranet hostnames and a Loose pattern extracts URLs from free text. The component-by-component breakdown explains each part of the pattern protocol capture hostname groups port validation path query fragment handling so you understand what it validates. Test URLs individually or paste free text to extract embedded URLs with position information. Copy patterns escaped for JavaScript Python or PostgreSQL regexp operators.
When to Use URL Regex Validator & Pattern
Use when validating user-submitted URLs in forms, extracting URLs from logs or free text, sanitizing href attributes in user-generated content, building URL shortener validation, or checking data quality in link databases.
How to Use URL Regex Validator & Pattern
Choose validation strictness Strict Practical Loose. Enter URLs to validate or free text to extract URLs from. View pattern breakdown, match details, and copy the pattern escaped for your target language.
Related Tools
Regex Tester & Debugger
Test regular expressions live with match highlighting, group capture display, and detailed regex execution explanation.
Regex Cheat Sheet & Reference
Complete regular expressions syntax reference with categorized patterns, quantifiers, lookaround assertions, and practical examples.
Email Regex Validator & Pattern
Validate email addresses against RFC 5322 compliant regex patterns with detailed explanation of common email regex approaches.