Returns a regex pattern for validating URL slugs — lowercase letters, numbers, and hyphens only. Access via MCP in Cursor or Windsurf, or call GET /v1/regex/pattern/slug directly. Perfect for validating blog post URLs, product identifiers, or API endpoints. The pattern enforces web-safe characters and prevents consecutive hyphens.
curl "https://tinyfn.io/v1/regex/pattern/slug" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/pattern/slug', {
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/slug',
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"
}
}
}
}
Returns a pattern like ^[a-z0-9]+(?:-[a-z0-9]+)*$ that matches lowercase alphanumeric characters with single hyphens as separators, no leading/trailing hyphens.
Call the tool through Claude or Cursor to get the regex, then use it in your validation logic. The deterministic pattern ensures consistent slug validation across your application.
No, it only allows lowercase letters (a-z), numbers (0-9), and single hyphens as separators. This follows standard URL slug conventions for SEO and readability.
Yes, the returned regex works perfectly for batch validation. Run it against your existing slugs to find any that don't meet standard URL slug requirements.
This provides a battle-tested, standards-compliant pattern that handles edge cases like preventing consecutive hyphens and ensuring proper start/end boundaries.
Get your free API key and start using Get Slug Pattern in seconds.
Get Free API Key