Regex Replace
Find and replace text with regex patterns in real time. Supports backreferences like $1, $2. No data leaves your browser.
Regex Replace
This regex find-and-replace tool lets you search for patterns and replace them with new text in real time. All six JavaScript regex flags are supported, and the replacement string understands backreferences like $1, $2, so you can rearrange captured groups. Matches are highlighted before you commit the replacement.
The search and replace runs locally in your browser. The text you enter is not uploaded, stored, or sent to a server, so you can transform content privately and quickly.
How to use
- Type or paste a regex pattern into the Regex Pattern field. No delimiters needed.
- Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), or y (sticky).
- Enter a replacement string in the Replace With field. Use
$1,$2for backreferences to captured groups. - Paste or type your test text into the editor below. Matches are highlighted as you type.
- Click Replace All to apply the replacement to the entire text.
- Use Copy to copy the result, Download to save it, or Clear to reset everything.
What are regular expressions?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for pattern matching within strings, such as finding specific words, validating formats like emails or phone numbers, or splitting text by complex delimiters.
JavaScript implements regex natively via the RegExp object. The same syntax works in most programming languages with minor variations. Regex find-and-replace is one of the most powerful text transformation techniques available to developers.
Input notes
Enter the regex pattern without delimiters. The flags are controlled by the checkboxes. The replacement string supports standard backreferences: $1 through $9 for captured groups, and $& for the entire match.
Example
Reformatting dates from MM/DD/YYYY to YYYY-MM-DD using backreferences:
--- Pattern ---
(\d{2})/(\d{2})/(\d{4})
--- Replacement ---
$3-$1-$2
--- Flags ---
g (global)
--- Test Text ---
Today is 04/29/2026 and tomorrow is 04/30/2026.
--- Result ---
Today is 2026-04-29 and tomorrow is 2026-04-30.
MCP integration
MCP (Model Context Protocol) lets AI agents and apps discover and run Coding.Tools utilities for repeatable conversions, formatting, hashing, and generation workflows.
MCP tool name: regex-replace
MCP endpoint: https://coding.tools/mcp
Call tools/list first. Each tool entry includes inputSchema, outputSchema, and examples so an AI agent or client can build valid arguments without guessing.
For tools/call, read result.content[0].text for the display value and result.structuredContent for machine parsing. Tool-level failures return isError: true; protocol failures return a JSON-RPC error.
Example tools/call request:
curl -s https://coding.tools/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"regex-replace","arguments":{"input":"Ticket ABC-123 is ready for review","options":{"pattern":"[A-Z]{3}-\\d{3}","replacement":"[ticket-id]","flags":"g"}}}}'
Most text and data tools accept an input string plus optional options. Browser-only image tools are listed for discovery and return a web UI link when they need browser image APIs.