Returns ready-to-use regex patterns for validating time formats. Access via MCP in Cursor or Windsurf, or REST at GET /v1/regex/pattern/time. Supports 12-hour (3:45 PM), 24-hour (15:45), and seconds variants. Each pattern includes proper boundary anchors and handles edge cases like leading zeros.
curl "https://tinyfn.io/v1/regex/pattern/time" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/pattern/time', {
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/time',
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"
}
}
}
}
Validates 12-hour format (1:30 PM, 12:05 AM), 24-hour format (13:45, 09:15), and optional seconds (14:30:25). Handles leading zeros and proper AM/PM notation.
Call the tool to get the regex pattern, then use it directly in your validation logic. The returned pattern includes anchors (^ and $) for complete string matching.
Yes, it enforces valid ranges: hours 00-23 (24-hour) or 1-12 (12-hour), minutes and seconds 00-59. Invalid times like 25:70 won't match.
The endpoint returns multiple pattern variants. Choose the one matching your format requirements: strict 24-hour, flexible 12-hour, or with optional seconds.
This provides battle-tested patterns that handle edge cases like midnight (12:00 AM), noon boundaries, and proper zero-padding validation that custom regex often miss.
Get your free API key and start using Get Time Pattern in seconds.
Get Free API Key