# Regex Lab

> Regex Lab is an open-source MCP server for developer tools. MCP server to test JavaScript regexes, explain patterns and detect catastrophic. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Website:** https://basitalisandhu.github.io/dev-mcp-servers/
- **Repository:** https://github.com/basitalisandhu/dev-mcp-servers/tree/HEAD/packages/regex-lab
- **MCP Registry name:** io.github.basitalisandhu/mcp-regex-lab
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp-regex-lab -- docker run -i --rm ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-regex-lab": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-regex-lab": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp-regex-lab": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-regex-lab": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-regex-lab": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-regex-lab:0.3.0"
      ]
    }
  }
}
```

## Tools

- `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.

## 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.

## Alternatives

- [Rexact](https://ai-powered.com/mcp/rexact): Rexact is an open-source MCP server for developer tools.
- [Slop Patterns](https://ai-powered.com/mcp/slop-patterns): Slop Patterns is an open-source MCP server for design and media.
- [Buildutilities MCP](https://ai-powered.com/mcp/buildutilities-mcp): Buildutilities MCP is an open-source MCP server for developer tools.
- [MCP Failure Lab](https://ai-powered.com/mcp/mcp-failure-lab-2): MCP Failure Lab is an open-source MCP server for developer tools.
- [QuassLabs API](https://ai-powered.com/mcp/quasslabs-api): QuassLabs API is a freemium MCP server for developer tools.
- [SimplyUtils](https://ai-powered.com/mcp/simplyutils): SimplyUtils is an open-source MCP server for developer tools.
- [Toolproof](https://ai-powered.com/mcp/toolproof): Toolproof is a free MCP server for security.
- [loremfile](https://ai-powered.com/mcp/loremfile): loremfile is a free MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/regex-lab
