Regex Replace

Search and replace with regular expressions and groups.

Regex Replace

.txt

Paste text or open a file to see the result.

What it does

Searches a text with a regular expression and replaces each match, with groups you can reuse in the replacement. It handles changes plain find and replace cannot, such as swapping first and last names or reformatting dates. You get the changed text and the number of replacements.

How to use the Regex Replace

  1. Type the Pattern, for example (\d{4})-(\d{2})-(\d{2}) for dates like 2024-12-31.
  2. In Replace with, use $1, $2 for the groups, for example $3.$2.$1; $& is the whole match.
  3. Set the Flags: g replaces every match, i ignores case.
  4. Copy or download the result from the Output box.

About the .txt format

.TXT file extension
File Type
Plain Text File
Category
Text Files
MIME
text/plain

The TXT file extension is a common file format that is used for storing text data.

Related tools

More in Text

Regex Replace questions

How do I use the Regex Replace?

Paste the text into the Input box or open a file, set the options, then copy or download the result.

Does renaming a file to .txt change its format?

No. The extension only tells programs what to expect, and the content of the file stays the same. To change the format, convert the file. The .txt page lists programs and converters for it.