regex-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@regex-mcptest pattern \d{3}-\d{2}-\d{4} on 'My SSN is 123-45-6789.'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
regex-mcp
MCP server for testing, explaining, debugging, and generating regular expressions. Works with any MCP client — Claude Code, Cursor, VS Code Copilot, Windsurf, and more.
Never leave your editor for regex again.
Features
Test — Run patterns against text with highlighted matches, capture groups, and coverage stats
Explain — Token-by-token breakdown with nested group indentation
Validate — Syntax checking with common pitfall warnings (greedy traps, anchor issues, unescaped dots)
Replace — Find and replace with capture group references ($1, $2)
Debug — Visual match markers with smart hints when patterns fail (case, anchors, whitespace, multiline)
Generate — Natural language to regex for 25+ common patterns (email, URL, UUID, date, phone, etc.)
Related MCP server: rxjs-mcp-server
Install
Claude Code
claude mcp add @muhammadalishahzad/regex-mcp -- npx -y @muhammadalishahzad/regex-mcpClaude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"regex": {
"command": "npx",
"args": ["-y", "@muhammadalishahzad/regex-mcp"]
}
}
}Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"regex": {
"command": "npx",
"args": ["-y", "@muhammadalishahzad/regex-mcp"]
}
}
}VS Code Copilot
Add to .vscode/mcp.json:
{
"servers": {
"regex": {
"command": "npx",
"args": ["-y", "@muhammadalishahzad/regex-mcp"]
}
}
}Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"regex": {
"command": "npx",
"args": ["-y", "@muhammadalishahzad/regex-mcp"]
}
}
}Tools
regex_test
Test a pattern against input text. Returns highlighted matches, positions, capture groups, and coverage stats.
Pattern: \d+
Input: "Order #123 has 4 items at $99.50"
Found 4 matches (8 chars, 25.0% of input)
Highlighted: Order #[123] has [4] items at $[99].[50]
Match 1:
Text: "123"
Position: 7–10
Length: 3
Match 2:
Text: "4"
Position: 15–16
Length: 1regex_explain
Token-by-token breakdown with group indentation for nested patterns.
Pattern: (?:https?://)([\w.-]+)(?:/(\w+))?
Breakdown:
(?: → start non-capturing group
h → literal 'h'
t → literal 't'
t → literal 't'
p → literal 'p'
s → literal 's'
? → optional (zero or one)
: → literal ':'
/ → literal '/'
/ → literal '/'
) → end group
( → start capture group
[\w.-] → any character in [\w.-]
+ → one or more times
) → end group
(?: → start non-capturing group
/ → literal '/'
( → start capture group
\w → any word character (a-z, A-Z, 0-9, _)
+ → one or more times
) → end group
) → end group
? → optional (zero or one)regex_validate
Check syntax and detect common pitfalls.
Pattern: ^.*foo.bar$
Flags: g
Valid regex pattern.
Flags:
g — global — find all matches
Warnings (3):
1. Unescaped '.' matches ANY character. Did you mean '\.'?
2. '.*' is greedy — it matches as much as possible. Consider '.*?'
3. Using anchors (^/$) with global flag (g). Add 'm' for per-line matching.regex_debug
Visual debugging with smart hints when patterns don't match.
Pattern: /^Hello/g
Input: "hello world" (11 chars)
Result: No matches.
Hints:
1. Case mismatch: With the 'i' flag, the pattern matches 1 time(s).When matches are found, shows visual markers:
Found 2 matches:
"Error on line 42: timeout. Error on line 99: crash."
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
Match 1 [0–15]: "Error on line 42"
Context: [Error on line 42]: timeout. Err...
Match 2 [27–52]: "Error on line 99: crash."
Context: ...timeout. [Error on line 99: crash.]regex_replace
Find and replace with capture group support.
Pattern: (\w+), (\w+)
Input: "Doe, John"
Replacement: $2 $1
Replacements: 1
Before:
Doe, John
After:
John Doeregex_generate
Generate regex from natural language descriptions. Supports 25+ common patterns.
Description: "email address"
Best match:
Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Description: Matches most common email address formatsAvailable categories: email, URL, IPv4, phone, date (ISO/US), time, hex color, UUID, number, decimal, HTML tag, credit card, ZIP code, MAC address, slug, camelCase, snake_case, password validation, JSON key, Markdown link, file extension, semver, and more.
Development
git clone https://github.com/MuhammadAliShahzad/regex-mcp.git
cd regex-mcp
npm install
npm run buildTest with the MCP Inspector:
npm run inspectorRun the server directly:
node build/index.jsHow it works
regex-mcp runs as a local stdio process — no network calls, no API keys, no LLM dependencies. All regex operations use the native JavaScript RegExp engine. Pattern explanation uses a built-in tokenizer, not AI.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceUnleashes LLM-powered agents to autonomously execute and debug web apps directly in your code editor, with features like webapp navigation, network traffic capture, and console error collection.Last updated21,240Apache 2.0
- AlicenseAqualityBmaintenanceExecute, debug, and visualize RxJS streams directly from AI assistants like Claude.Last updated6573MIT
- Flicense-qualityFmaintenanceGives Claude semantic search superpowers to find and reuse existing patterns in your codebase.Last updated16
- AlicenseCqualityCmaintenanceEnables AI-powered automated testing, security scanning, code review, and maintenance tasks directly within Claude Code or desktop.Last updated123MIT
Related MCP Connectors
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Let Claude, Cursor, or ChatGPT author Mermaid diagrams your team can read and share.
Read and write your Fresh Jots notes from Claude, Cursor, and any MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/MuhammadAliShahzad/regex-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server