Returns regex patterns for phone number validation across different formats and countries. Access via MCP in Cursor/Windsurf or REST at `/v1/regex/pattern/phone`. Get patterns for US format `^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$`, international formats, or loose validation. Perfect for form validation in AI-assisted development workflows.
curl "https://tinyfn.io/v1/regex/pattern/phone" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/pattern/phone', {
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/phone',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
Supports US/NANP formats (with/without country code, various separators), international E.164 format, and configurable loose patterns for different regional formats.
Call the MCP tool to get the pattern, then use it directly in your validation code. Works seamlessly in Cursor, Windsurf, and other MCP-compatible editors for instant form validation.
Yes, the tool provides strict patterns for specific formats and loose patterns that accept common variations like spaces, dashes, parentheses, and optional country codes.
US patterns handle NANP format with area codes, while international patterns follow E.164 standard with country codes. Both include variations for common formatting.
Standard patterns focus on core phone numbers. For extensions and complex parsing, combine with additional validation or use the patterns as a first-pass filter.
Get your free API key and start using Get Phone Pattern in seconds.
Get Free API Key