
Regex Lab
MCP server to test JavaScript regexes, explain patterns and detect catastrophic
- Pricing
- Open source
- Platforms
- CLI, self-hosted
- Runs
- Locally
- Version
- 0.3.0
- Listing updated
- today
Similar MCP servers
About Regex Lab
Regex Lab is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
The README describes Regex Lab as a Model Context Protocol server that runs JavaScript regular expressions against sample strings inside a worker thread, so a runaway pattern is cut off when it passes the timeout instead of stalling the client. It can list every match with offsets and capture groups, preview a replacement, and walk through a pattern construct by construct.
Its third tool targets ReDoS risk. It first looks for static warning signs such as nested unbounded repeats and overlapping alternatives, then times runs against crafted inputs of increasing length to confirm or clear the pattern. The README is clear that a clean result is evidence rather than proof of safety.
It suits developers who ask an AI assistant to write or review regexes in editors like Claude Code, Claude Desktop or Cursor. Because it uses V8 syntax, the README warns that PCRE, RE2 and Python patterns can behave differently.
Install
Run in a terminal
claude mcp add mcp-regex-lab -- docker run -i --rm ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0Add to claude_desktop_config.json
{
"mcpServers": {
"mcp-regex-lab": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-regex-lab": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"mcp-regex-lab": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-regex-lab": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mcp-regex-lab": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
]
}
}
}Using several servers? Build one config file with the MCP config generator.
Tools this server provides (3)
Taken from the project documentation; the running server may differ.
- test_regex
- Tests a pattern against sample strings and returns matches, groups and an optional replace preview.
- explain_regex
- Describes a pattern construct by construct, with capture group count and flag meanings.
- check_redos
- Looks for static and timed signs of catastrophic backtracking in a pattern.
What it does
- Timeout-guarded regex testing
- Runs each test in a worker thread that is terminated when it exceeds a configurable timeout.
- Match and group reporting
- Returns every match per sample with offsets, text, and numbered and named groups.
- Replacement preview
- Optionally shows the result of a replace operation using the supplied pattern and flags.
- Construct-by-construct explanation
- Describes literals, classes, anchors, groups, lookarounds, quantifiers and alternation in indented form.
- Catastrophic backtracking check
- Combines static findings with timed probes on crafted inputs to flag slow patterns.
- No network or file access
- The README states the server makes no network calls, reads no local files and sends no telemetry.
Good for
- Checking a regex against sample inputs before committing it to code
- Explaining an unfamiliar pattern piece by piece during code review
- Finding out whether a pattern is vulnerable to ReDoS before shipping it
- Previewing a search-and-replace expression on sample text
Pricing
Open source
MIT licensed, free to run self-hosted
Prices change. Check basitalisandhu.github.io before you buy.
Regex Lab FAQ
Does Regex Lab make network requests or read files?
The README says it has no network access, no local file access and no telemetry.
Which regex dialect does it use?
It follows V8 (Node.js) syntax. The README notes that PCRE, RE2 and Python differ in places such as possessive quantifiers and lookbehind.
How do I install it?
The README shows a Claude Code command and an .mcp.json entry that run the pinned Docker image ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0 over stdio. It is not yet published to npmjs.com, so npx does not work.
Can a clean ReDoS check prove a pattern is safe?
No. The README says no findings and flat timings are evidence, not proof, that a pattern is safe.
Is Regex Lab free?
Yes. Regex Lab is open source, so you can use and self-host it for free.
How do I add Regex Lab to Claude Code?
Run this command in your terminal: claude mcp add mcp-regex-lab -- docker run -i --rm ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0
What are the best alternatives to Regex Lab?
The closest alternatives to Regex Lab are Rexact, Slop Patterns, Buildutilities MCP, MCP Failure Lab and QuassLabs API.
Where this comes from
- Description: written from the project's README, the project's website and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.
