What is REGEXREPLACE in Google Sheets?

When to use it

Use REGEXREPLACE in cleaning pipelines for imports, standardizing SKUs, or removing unwanted characters before VLOOKUP.

When to skip it

Skip REGEXREPLACE for one cell manual edits or when SUBSTITUTE on a fixed string is clearer.

How it works

  1. 1

    Pass the source text as the first argument.

  2. 2

    Write the regex pattern to find as the second argument.

  3. 3

    Pass replacement text as third argument; use $1 for capture group inserts.

  4. 4

    Apply globally down a column with MAP or ARRAY spill behavior.

  5. 5

    Chain two REGEXREPLACE calls when multiple cleanup passes are needed.

  6. 6

    Spot-check ten random rows after bulk replace before deleting source columns.

Examples in Google Sheets

Phone digits only

=REGEXREPLACE(A2, "[^0-9]", "") keeps only numerals for matching.

Normalize spaces

=REGEXREPLACE(B2, "\s+", " ") collapses double spaces to one.

Strip HTML tags

=REGEXREPLACE(C2, "<[^>]+>", "") removes simple tags from scraped text.

Common mistakes

  • Replacement string with unescaped $ confusing capture references.
  • Pattern too aggressive, deleting meaningful punctuation.
  • Not backing up source column before irreversible cleanup.
  • Expecting REGEXREPLACE to fix structural CSV problems alone.
  • Running heavy regex on full column A:A in a shared mega sheet.

Frequently asked questions

REGEXREPLACE vs SUBSTITUTE?
SUBSTITUTE swaps fixed strings. REGEXREPLACE uses pattern matching.
Use capture groups?
Yes. Replacement can reference $1, $2 from parentheses in the pattern.
Replace all matches?
REGEXREPLACE replaces all matches in the cell by default in Sheets.
REGEXREPLACE on numbers?
Convert with TEXT first or apply on text-formatted columns.
REGEXREPLACE tools?
Better Sheets regex replacer tool helps test patterns before pasting into sheets.
Case sensitive?
Default regex case rules apply. Adjust pattern classes as needed.
REGEXREPLACE errors?
Invalid regex syntax returns formula parse errors. Test in small cells.

Related Tutorials

Watch how REGEXREPLACE works

Watch more tutorials
REGEXMATCH Formula Generator for Google Sheets

REGEXMATCH Formula Generator for Google Sheets

Revolutionize the way you handle data with the BetterSheets REGEXMATCHER...
200 REGEXMATCH Examples in Google Sheets

200 REGEXMATCH Examples in Google Sheets

Uncover the Magic of Regex Match! 🎩✨ Explore 200+ Examples at BetterShee...
How to Replace Text with a Blank Cell in Google Sheets

How to Replace Text with a Blank Cell in Google Sheets

Learn the Quick Fix! Replace Text with Blank Cell in Google Sheets Hassl...

Related blog posts

Guides that explain REGEXREPLACE in more depth.

Browse the blog

Related terms