Developer Utilities

Regex Replacer

All tools

Rewrite text with a regular expression and capture-group references, with the result updating live.

How it works

Four simple steps

1

Write the pattern

Use capture groups for the parts you want to keep or move.

2

Write the replacement

Reference groups with

or
lt;name>, and the whole match with
amp;.

3

Set flags

g replaces every match; add i or m when needed.

4

Copy the result

The rewritten text updates live and can be copied or downloaded.

Regex Replacer

About Regex Replacer

A CSV export has dates as 31/12/2025 and the import job wants 2025-12-31. Editing 2,000 rows by hand is not an option, and a spreadsheet formula is fiddly. One pattern with three capture groups and a replacement of $3-

-
does it in a second.

There are three fields: pattern, replacement and flags. The output panel shows the input with String.replace applied, and it refreshes whenever any field changes. Replacements support the standard JavaScript tokens:

to $99 for numbered groups,
lt;name> for named groups,
amp; for the whole match and $ for a literal dollar sign. Keep g in the flags to replace every occurrence; without it only the first match changes. Add i for case-insensitive matching and m when ^ and $ should work per line.

Watch the backslashes in the pattern box. The box takes the pattern exactly as typed, the way a regex literal would, so write \s+ to match whitespace. Writing \\s+ the way you would inside a quoted string in code looks for a literal backslash followed by s, and nothing gets replaced. To see which matches a pattern finds before changing anything, try it in the regex tester with match table. For literal text without patterns, the plain find and replace tool is simpler.

The replacement runs on the text in your browser. Nothing you paste is sent to OneDevToolkit.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Capture each word and reorder them in the replacement. The pattern (\w+) (\w+) with replacement

turns 'Doe John' into 'John Doe'. Keep g to apply it to every line.

Write $ in the replacement. A $ followed by a number, &, or < may be read as a reference, so doubling it is the reliable way to get one dollar sign in the output.

No. The replacement field is a string with $ tokens only. For logic such as uppercasing a group or doing arithmetic on numbers, use a short script in your editor or the browser console.

View more FAQs

Related tools

View all

Cron Calendar

Explain cron expressions and preview the next run times in any timezone.

Open

CSV to SQL

Infer column types and generate CREATE TABLE + INSERT statements from CSV.

Open

SQL Query Builder

Build SELECT queries visually and reverse-parse SQL into a structure tree.

Open

Log Pattern Miner

Cluster log lines into templates, surface anomalies, and mask PII locally.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools