Regex Utilities

Get Url Pattern

Returns a regex pattern for URL validation that matches HTTP/HTTPS URLs with proper domain structure. Access via MCP in Cursor or Windsurf, or REST at GET /v1/regex/pattern/url. The pattern validates standard web URLs including subdomains, ports, paths, and query parameters. Deterministic output ensures consistent validation across AI agents and applications.

API Endpoint

GET /v1/regex/pattern/url

Code Examples

curl "https://tinyfn.io/v1/regex/pattern/url" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/pattern/url', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/regex/pattern/url',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's regex tools:

{
  "mcpServers": {
    "tinyfn-regex": {
      "url": "https://tinyfn.io/mcp/regex",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What URL formats does the regex pattern validate?

Validates HTTP/HTTPS URLs with domains, subdomains, ports, paths, query parameters, and fragments. Covers standard web URLs but may not match all RFC 3986 edge cases.

How do I use the URL regex pattern in my MCP agent workflow?

Call the tool to get the pattern, then use it for input validation in Claude Code or Cursor. Perfect for form validation or filtering URL lists in automated tasks.

Does the pattern match localhost and IP addresses?

Depends on the specific pattern returned. Test with your target URLs since some regex patterns focus on public domains while others include localhost/IPs.

Can I modify the returned regex pattern for stricter validation?

Yes, the returned pattern is a starting point. You can add anchors (^$), escape special chars, or combine with other patterns for custom validation rules.

How does this compare to browser URL validation APIs?

Provides a lightweight regex alternative to URL constructor validation. Useful when you need pattern-based validation without JavaScript's URL parsing overhead.

Try Get Url Pattern Now

Get your free API key and start using Get Url Pattern in seconds.

Get Free API Key