Skip to content
Google Sheets

REGEXREPLACE function in Google Sheets

Replaces part of a text string with a different text string using regular expressions.

=REGEXREPLACE(text, regular_expression, replacement)

REGEXREPLACE syntax and parameters

Three arguments, three required.

  • textstringRequired

    The text, a part of which will be replaced.

  • regular_expressionstringRequired

    The regular expression. All matching instances in text will be replaced.

  • replacementstringRequired

    The text which will be inserted into the original text.

REGEXREPLACE examples

Formulas you'll actually reuse.

  1. Keep only the digits of a phone number:

    =REGEXREPLACE(A2, "[^0-9]", "")

    Result"4915112345678"

  2. Reorder an ISO date into DD.MM.YYYY with capture groups ($1…):

    =REGEXREPLACE(A2, "(\d{4})-(\d{2})-(\d{2})", "$3.$2.$1")

    Result"14.08.2026"

REGEXREPLACE in Excel

Same name — your formula ports as-is.

Try REGEXREPLACE in the playground

Edit the example — nothing to install.

Preloaded with the REGEXREPLACE formula from Example 1 — change anything and watch it respond.

Loading the editor…