Regex is powerful but hard to debug. This API lets you test patterns, get human-readable explanations, find common patterns, replace text, benchmark performance, and escape special characters — all via REST.
Try It Right Now
curl -s -X POST https://api.lazy-mac.com/regex/api/v1/test \
-H "Content-Type: application/json" \
-d '{"pattern": "\\d+", "text": "I have 42 apples and 7 oranges"}' | jq
Response:
{
"pattern": "\\d+",
"text": "I have 42 apples and 7 oranges",
"matchCount": 2,
"matches": [
{ "match": "42", "index": 7, "length": 2 },
{ "match": "7", "index": 21, "length": 1 }
]
}
All Endpoints
| Endpoint | Description |
|---|---|
POST /api/v1/test |
Test a pattern against text |
POST /api/v1/replace |
Find and replace with regex |
POST /api/v1/split |
Split text by pattern |
POST /api/v1/validate |
Check if pattern is valid |
GET /api/v1/patterns |
17 common pre-built patterns |
GET /api/v1/patterns/:name |
Get specific pattern (email, url, phone...) |
POST /api/v1/explain |
Human-readable regex explanation |
POST /api/v1/escape |
Escape special characters |
POST /api/v1/benchmark |
Performance benchmark |
Browse Pre-Built Patterns
curl -s https://api.lazy-mac.com/regex/api/v1/patterns | jq '.patterns[:3]'
[
{ "name": "email", "description": "Matches standard email addresses" },
{ "name": "url", "description": "Matches HTTP and HTTPS URLs" },
{ "name": "phone", "description": "Matches US/international phone numbers" }
]
17 patterns included: email, url, phone, ipv4, ipv6, date, uuid, hex color, credit card, SSN, and more.
Explain a Regex
curl -s -X POST https://api.lazy-mac.com/regex/api/v1/explain \
-H "Content-Type: application/json" \
-d '{"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}' | jq
Use as an MCP Server
{
"mcpServers": {
"regex": {
"url": "https://api.lazy-mac.com/regex/mcp"
}
}
}
Ask Claude: "Test this regex pattern against my sample text" or "Explain what this regex does"
Pricing
| Tier | Requests/mo | Price |
|---|---|---|
| Free | 100 | $0 |
| Pro | 10,000 | $9/mo |
| Business | Unlimited | $49/mo |
Browse all 22 APIs at api.lazy-mac.com →
More from the lazymac API Toolkit:
- Text Analysis API — Sentiment and readability scoring
- Email Validator API — Full email validation
- Fake Data Generator API — Realistic test data
Top comments (0)