REGEXREPLACE
Replace portions of text identified by a regular-expression pattern.
Syntax
=REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])Worked example
Replace each run of spaces with one hyphen.
=REGEXREPLACE("A 12 B"," +","-")Result A-12-B
Microsoft documentation
Check the arguments, supported editions and behavior of this function in Microsoft’s reference.
Microsoft referenceRemove Special Characters In Excel Using the REGEXREPLACE Function
Practice REGEXREPLACE
Replace each run of spaces with one hyphen.
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 |
Show example formula
=REGEXREPLACE(B2,B3,B4) Lesson quiz
Answer three questions to see your level in this lesson.
