Home / Convert / Regex Find & Replace

Regex Find and Replace Online

Transform text with regular expressions, optional flags, and capture groups such as $1.

▣ Processed locally in your browser. Nothing is uploaded.

Your text
0 lines · 0 characters

Changed text

.*
Your transformed text will appear here.

Invalid patterns are reported before anything changes.

What is regex find and replace?

A regular expression describes a text pattern rather than one exact phrase. It can find groups of digits, repeated whitespace, line beginnings, or structured identifiers. TextUnicorn uses the regular-expression syntax built into JavaScript.

Simple regex patterns

PatternMatches
\d+One or more digits
\s+One or more whitespace characters
\w+A run of word characters in JavaScript regex syntax
^Note:“Note:” at the beginning of input, or of each line with multiline mode

Capture groups and replacements

Parentheses capture part of a match. The replacement can reuse captured text with $1, $2, and so on.

Pattern:     Order (\d+)
Replacement: ID-$1
Input:       Order 123
Output:      ID-123

Flags: g, i, and m

Practical examples

Normalize repeated whitespace

Pattern: \s+
Replacement: a single space

Reformat IDs

Pattern: ITEM-(\d+)
Replacement: Product $1

Change ISO-style dates

Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3.$2.$1

Test date expressions with your real formats: regular expressions match text patterns but do not validate whether a date actually exists.

When to use the simpler tool

If you only need to replace one known word or phrase, Find & Replace is easier and reduces the chance of an overly broad match. Use regex when the varying structure itself is what you need to find.

Frequently asked questions

What regex syntax does TextUnicorn use?

It uses the regular-expression implementation available in your JavaScript-capable browser.

What does $1 mean?

It inserts the text captured by the first pair of parentheses in the pattern.

Can an invalid regex damage my text?

The tool reports invalid expressions before producing a replacement. Keep a copy of important source text and test broad patterns on a small sample first.

Is regex processing local?

Yes. The pattern and text are processed in your browser.