Skip to content

Regex Engineering Hub · free · no sign-up

Regex Replace Tool

Find text with a regular expression and replace it, using captured groups.

How it works Report a problem

Ultimate Regex Find & Replace

Perform complex text transformations using capture groups and advanced substitution patterns

PRO TRANSFORMATION
Source Text
Side-by-Side Comparison
Original

                        
Transformed

                        

About the Regex Replace Tool

Find text with a regular expression and replace it, using captured groups.

How to use the Regex Replace Tool

  1. Enter the Find (Regex Pattern), the Replace With text (use $1, $2 for groups) and the Flags.
  2. Paste your text, or click Sample.
  3. Press Transform Text Now, then Copy Result.

Worked example

Find (\w+)\s(\w+) and replace with $2 $1. "John Smith" becomes "Smith John".

Tips

  • Add the g flag to replace every match, not just the first.
  • Keep a copy of the original text in case the result is not what you expected.

Frequently asked questions

What does $1 mean?
The text captured by the first set of brackets in your pattern.