Home / Servers / Text Toolkit / regex_replace

Regex replace

An MCP tool from the Text Toolkit server, hosted on mcp.hjlabs.in.

Replace every match of a regular expression in a text. The replacement may use $1, $<name> and $& as in JavaScript. Returns the new text and the number of replacements.

Name on the gateway: text__regex_replace · read-only.

Parameters

NameTypeDescription
pattern requiredstringThe regular expression, without slashes.
replacement requiredstringReplacement string; "$1" inserts group 1.
text requiredstringText to change.
flagsstringFlags from i, m, s, u. Default none; g is implied.

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "text__regex_replace",
  "arguments": {
    "pattern": "…",
    "replacement": "…",
    "text": "…"
  }
}

Or connect the Text Toolkit server directly, which lists 43 tools including this one:

Run in your terminal
claude mcp add --transport http hj-text https://mcp.hjlabs.in/mcp/text \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the regex replace tool with pattern set to ….

More from Text Toolkit