@jkumonpm/regex-tester-mcp
v1.0.2
Published
Regex Tester MCP server — test, explain, and template regular expressions
Maintainers
Readme
regex-tester-mcp
Regex Tester MCP server. Test, explain, and template regular expressions.
No shell. No external tools. Pure native RegExp.
Install
npm install -g regex-tester-mcpUsage
Claude Desktop / Cursor / OpenCode
Add to your MCP config:
{
"mcpServers": {
"regex-tester": {
"command": "npx",
"args": ["-y", "regex-tester-mcp"]
}
}
}Tools
test_regex — Test Regex
Test a regular expression against a string. Returns all matches with capture groups.
Input:
{
"pattern": "(\\d+)",
"test_string": "abc123def456",
"flags": "g"
}Output:
{
"pattern": "(\\d+)",
"flags": "g",
"test_string": "abc123def456",
"match_count": 2,
"matches": [
{ "match": "123", "groups": { "1": "123" }, "index": 3 },
{ "match": "456", "groups": { "1": "456" }, "index": 9 }
]
}explain_regex — Explain Regex
Explain a regular expression in human-readable form.
Input:
{
"pattern": "^\\d{3}-\\d{2}-\\d{4}$"
}Output:
Regular expression: /^\d{3}-\d{2}-\d{4}$/
Breakdown:
1. '^' — Matches the start of the string
2. '\d' — Matches any digit (equivalent to [0-9])
3. '{3}' — Quantifier: Matches exactly 3 times
4. '-' — Literal character: '-'
5. '\d' — Matches any digit (equivalent to [0-9])
6. '{2}' — Quantifier: Matches exactly 2 times
7. '-' — Literal character: '-'
8. '\d' — Matches any digit (equivalent to [0-9])
9. '{4}' — Quantifier: Matches exactly 4 times
10. '$' — Matches the end of the stringregex_templates — Regex Templates
Get common regex templates. Optionally filter by category.
Input:
{
"category": "validation"
}Output:
{
"count": 10,
"category": "validation",
"templates": [
{
"name": "email",
"category": "validation",
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"description": "Email address",
"example": "[email protected]"
}
]
}Built-in Templates
| Name | Category | Description |
|------|----------|-------------|
| email | validation | Email address |
| url | validation | HTTP/HTTPS URL |
| phone_tw | validation | Taiwan phone number |
| phone_us | validation | US phone number |
| ipv4 | validation | IPv4 address |
| date_iso | validation | ISO date (YYYY-MM-DD) |
| time_24h | validation | 24-hour time (HH:MM) |
| hex_color | validation | Hex color code |
| credit_card | validation | Credit card (Visa/MC/Amex) |
| uuid | validation | UUID v4 |
| html_tag | extraction | HTML tag extraction |
| digits | extraction | Extract all digits |
| words | extraction | Extract all words |
| hashtags | extraction | Extract hashtags |
Design
| Feature | Why |
|---------|-----|
| Zero runtime deps | Only @modelcontextprotocol/sdk and zod |
| Native RegExp | No external regex libraries needed |
| Structured output | AI reads matches/groups precisely |
| Human-readable explanations | Token-by-token breakdown |
| 14 built-in templates | Common patterns ready to use |
License
MIT
