
Regex Lab
io.github.basitalisandhuv0.1.1更新於 Oct 5, 2026
Test regular expressions in a timeout-guarded worker, explain them, find catastrophic backtracking.
概覽
讓助理用樣本測試 JavaScript 正規表達式、逐項解釋模式,並檢查是否有災難性回溯。
- 功能
- 提供三個處理 JavaScript(V8)正規表達式的工具。test_regex 以模式和旗標比對最多 50 個樣本字串,回傳每個相符項的位移、文字、編號與具名群組,以及可選的取代預覽。explain_regex 逐項說明字面值、字元類別、跳脫、錨點、群組、環視、量詞和分支,並給出捕獲群組數與旗標含義。check_redos 回報巢狀無界重複、重複下的重疊分支等靜態問題,再用計時探測確認或排除風險。
- 適用情境
- 適合在撰寫、除錯或審查正規表達式時使用,需要相符細節、白話解釋或快速排查易導致 ReDoS 的模式。在重視正規表達式正確性與安全性的編輯器或編碼流程中很實用。
- 執行需求
- 以 npm 套件形式透過 stdio 在本機執行,通常用 npx 啟動;也發布了 Docker 映像 ghcr.io/basitalisandhu/mcp-regex-lab:0.1.1。npm 方式需要 Node.js。未宣告驗證、環境變數、標頭、網路存取或本機檔案存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Regex Lab,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
regex-lab MCP server
Tests JavaScript regular expressions against sample strings, explains a pattern construct by construct, and looks for catastrophic backtracking. Every execution runs in a worker thread that is terminated when it exceeds the timeout, so a pathological pattern cannot hang the server.
Part of dev-mcp-servers. Stdio transport only; the server never opens a port.
Tools
Install
Claude Code:
Add -s user to make it available in every project. Any client that reads .mcp.json (Claude Code, Claude Desktop, Cursor):
Pin the version as shown so that an update to the package cannot change what runs in your editor without you noticing. From a checkout, use "command": "node", "args": ["<path>/packages/regex-lab/dist/index.js"] after npm install && npm run build at the repository root.
What it touches
- Network: None.
- Local files: None.
- Telemetry: none.
Notes
- Syntax follows V8 (Node.js). PCRE, RE2 and Python differ in places such as possessive quantifiers and lookbehind.
ganddflags are added automatically when matching; the replacement preview uses the flags you gave.- No findings and flat timings are evidence, not proof, that a pattern is safe.
Build and test
Tests use node:test and the SDK's in-memory transport; they do not reach the network.
Licence
MIT. See LICENSE.
來源:packages/regex-lab/README.md,提交 58c8c95
工具
0版本歷史
1- v0.1.1最新Oct 5, 2026


