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
| Name | Type | Description |
|---|---|---|
pattern required | string | The regular expression, without slashes. |
replacement required | string | Replacement string; "$1" inserts group 1. |
text required | string | Text to change. |
flags | string | Flags 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:
{
"name": "text__regex_replace",
"arguments": {
"pattern": "…",
"replacement": "…",
"text": "…"
}
}Or connect the Text Toolkit server directly, which lists 43 tools including this one:
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 ….