tool::regex-guide
regex url
/^https?:\/\/[^\s\/$.?#].[^\s]*$/i
URL Validation
Regex Pattern
/^https?:\/\/[^\s\/$.?#].[^\s]*$/i
Flags:
iPattern Breakdown
^https?http or https scheme:\/\/Literal ://[^\s\/$.?#]First domain char: not whitespace, slash, dot, $, ?, #.Any single character[^\s]*Rest of URL: any non-whitespace characters$End of stringMatching Examples
✓
https://example.com✓
http://sub.domain.org/path?q=1✓
https://api.site.io/v1/usersNon-Matching Examples
✗
ftp://file.server.com✗
example.com✗
https://✗
//no-scheme.comValidates URLs starting with http or https. Allows standard URL components including domain, path, and query string. Other schemes like ftp or mailto require separate patterns.
Language Usage
Common Use Cases
- ▸Validate website URL input fields
- ▸Filter valid URLs from a list of links
- ▸Pre-validate URL format in web crawlers
- ▸Validate homepage URL in user profiles
- ▸Verify webhook URLs before registration
Related Patterns
ad · 300×250
// related tools