Escapes special regex characters in text strings to prevent pattern matching errors. Access via MCP in Cursor/Windsurf or REST at `/v1/regex/escape`. Input "[email protected]" outputs "user@domain\.com" with backslashes added. Essential for sanitizing user input before regex operations in AI agents.
curl "https://tinyfn.io/v1/regex/escape" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/escape', {
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/escape',
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"
}
}
}
}
Escapes all special regex metacharacters: . ^ $ * + ? { } [ ] \ | ( ). These become literal characters when escaped with backslashes.
Call the escape_pattern tool with your text string. It returns the escaped version ready for safe regex compilation without pattern interpretation errors.
Escape user input when you want literal matching, not pattern matching. Don't escape actual regex patterns you intend to use for matching.
Yes, it preserves Unicode characters while only escaping ASCII regex metacharacters. Non-ASCII characters pass through unchanged.
This ensures complete coverage of all regex metacharacters and handles edge cases. Manual escaping often misses characters like parentheses or brackets.
Get your free API key and start using Escape Pattern in seconds.
Get Free API Key