Returns production-ready regex patterns for validating major credit card types including Visa, Mastercard, American Express, and Discover. Access via MCP in Cursor or Windsurf for instant pattern generation, or call GET /v1/regex/pattern/credit-card directly. Outputs industry-standard patterns that catch format errors before payment processing, saving API calls and improving user experience.
curl "https://tinyfn.io/v1/regex/pattern/credit-card" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/pattern/credit-card', {
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/credit-card',
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"
}
}
}
}
Covers all major card types: Visa (4xxx), Mastercard (5xxx), American Express (34xx/37xx), and Discover (6xxx). Each pattern validates both number length and starting digit requirements per industry standards.
In Cursor or Windsurf, ask your AI assistant to 'get credit card validation regex'. The MCP tool returns the pattern instantly, which you can then integrate into form validation or payment processing code.
No, this returns format validation patterns only (length and starting digits). For Luhn algorithm validation, combine with TinyFn's credit card validation tool for complete verification.
The endpoint returns comprehensive patterns for all major types. Filter client-side if you need specific card validation, or use the individual card type validation tools for targeted checks.
TinyFn provides tested, production-ready patterns that follow current payment industry standards. No guesswork or outdated patterns that miss edge cases in real payment forms.
Get your free API key and start using Get Credit Card Pattern in seconds.
Get Free API Key