Regex Utilities

Regex Replace

Replace text patterns using regular expressions with deterministic results. Available via MCP in Cursor and other AI editors, or REST API at /v1/regex/replace. Pass your text, regex pattern, and replacement string — get consistent output every time. Supports global replacements and capture groups for complex text transformations.

API Endpoint

GET /v1/regex/replace

Code Examples

curl "https://tinyfn.io/v1/regex/replace" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/regex/replace', {
  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/replace',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

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"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I replace all email addresses in text with [REDACTED]?

Use pattern `[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,}` with replacement `[REDACTED]`. The tool will find and replace all email matches globally.

Can I use capture groups to rearrange matched text?

Yes, use parentheses in your pattern like `(\d{4})-(\d{2})-(\d{2})` and reference groups in replacement with `$2/$3/$1` to transform dates from YYYY-MM-DD to MM/DD/YYYY format.

What happens if my regex pattern is invalid?

The tool returns an error with details about the invalid pattern. Always test complex regex patterns first with simpler text to verify syntax.

How can MCP agents use this for data cleaning workflows?

AI agents in Cursor or Windsurf can chain regex replace operations to clean datasets — remove phone number formatting, standardize dates, or sanitize user input reliably.

Does this support case-insensitive matching?

The tool follows standard regex behavior. Use inline flags like `(?i)pattern` in your regex to enable case-insensitive matching for specific patterns.

Try Regex Replace Now

Get your free API key and start using Regex Replace in seconds.

Get Free API Key