Regex

io.github.rog0x由 GitHub 帳號 rog0x 發布v1.0.1更新於 Oct 24, 2026

Regex test, explain, replace patterns for AI agents

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

一個本機 MCP 伺服器,為助理提供正規表示式測試、取代、擷取、解釋與文字轉換工具。

可以做什麼
用正規表示式測試文字,回傳所有符合項目及其位置、擷取群組與具名群組。使用 $1、$2、$&、$ 等擷取群組參照進行尋找與取代。將所有符合項目擷取為結構化陣列,可只回傳指定擷取群組。逐項解釋正規表示式及其旗標的含義。套用並串接文字轉換,例如大小寫轉換、去除空白、行去重、排序,以及字數、字元數、行數統計。
適用情境
適合處理正規表示式或大量文字時使用:讓助理驗證樣式、用擷取群組改寫文字、從文件中擷取結構化符合項目,或解釋不熟悉的表示式。偵錯正規表示式與重複性文字清理時特別方便,不必離開對話。
執行需求
以本機 Node.js 程序執行,透過 npm 套件 @rog0x/mcp-regex-tools 安裝;README 使用 npm install 與 npm run build 建置,並以 node 註冊建置後的 dist/index.js。需要設定桌面用戶端。未宣告任何身分驗證、環境變數或標頭。
安裝前請注意
傳入工具的文字由本機伺服器程序處理;未宣告第三方服務或憑證。取代與擷取只作用於你提供的文字,用於檔案或程式碼前請先檢查結果。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Regex,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-regex-tools

Regex and text processing tools for AI agents via the Model Context Protocol (MCP).

Tools

ToolDescription
regex_testTest a regex pattern against text. Returns all matches with indices, captured groups, and named groups.
regex_replaceFind and replace using regex with support for capture group references ($1, $2, $&, $<name>).
regex_extractExtract all matches of a pattern from text as a structured array. Optionally return only a specific capture group.
regex_explainParse a regex pattern and return a human-readable explanation of each component and flag.
text_transformApply common text transformations: camelCase, snake_case, kebab-case, PascalCase, UPPER, lower, title case, reverse, trim, deduplicate lines, sort lines, remove blank lines, count words/chars/lines. Chain multiple transforms in one call.

Setup

bash
npm installnpm run build

Usage with Claude Desktop

Add this to your Claude Desktop config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
json
{  "mcpServers": {    "regex-tools": {      "command": "node",      "args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]    }  }}

Usage with Claude Code

bash
claude mcp add regex-tools node D:/products/mcp-servers/mcp-regex-tools/dist/index.js

Or add to your .mcp.json:

json
{  "mcpServers": {    "regex-tools": {      "command": "node",      "args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]    }  }}

Examples

Test a regex

regex_test({ pattern: "(\\d{4})-(\\d{2})-(\\d{2})", text: "Today is 2026-03-19 and tomorrow is 2026-03-20" })

Replace with capture groups

regex_replace({ pattern: "(\\w+)\\s(\\w+)", replacement: "$2 $1", text: "hello world" })

Extract matches

regex_extract({ pattern: "[\\w.]+@[\\w.]+", text: "Contact us at [email protected] or [email protected]" })

Explain a regex

regex_explain({ pattern: "^(?:https?://)?(?:www\\.)?([\\w-]+)\\.\\w{2,}$", flags: "i" })

Transform text

text_transform({ text: "hello world example", transforms: ["PascalCase"] })text_transform({ text: "some text\nwith\nlines\nwith\nduplicates\nlines", transforms: ["deduplicate_lines", "sort_lines"] })

License

MIT

來源:README.md,提交 b5ed2c9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分