Text
Excel 365
◉ 24 views
=REGEXREPLACE()
REGEXREPLACE Function
Applies To:
Excel for Microsoft 365Excel for Microsoft 365 for Mac
=REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])
Hover argument names in the table for details.
Output typeText
Popularity35 / 100
VolatileNo
Dynamic ArrayNo
Download sample .xlsx ▦ Try in Playground
Dedicated file for this function — safe & lightweight · sample data + live formulas
⬇ Download Sample Workbook
A dedicated .xlsx for =REGEXREPLACE() with Persian sample data & live formulas — open in Excel and practice.
- Sheet “Sample” — data table + formula in place
- Sheet “Guide” — syntax, arguments & tips from this page
- Instant & secure (token + rate limit)
Quiz this function
%d questions — syntax, example & errors — test yourself!
◧ Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
text |
Text | Required | The text or the reference to a cell containing the text you want to replace strings within. |
pattern |
Text | Required | The regular expression ("regex") that describes the pattern of text you want to replace. |
replacement |
Text | Required | The text you want to replace instances of pattern. |
occurrence |
Number | Required | Specifies which instance of the pattern you want to replace. By default, occurrence is 0, which replaces all instances. A negative number replaces that instance, searching from the end. |
case_sensitivity |
Number | Required | Determines whether the match is case-sensitive. By default, the match is case-sensitive. Enter one of the following:0: Case sensitive1: Case insensitive |
▣ Examples
▦ Data
| Cell | Value |
|---|---|
A2 |
SoniaBrown |
A3 |
SoniaBrown |
Example 1
=REGEXREPLACE(A2,"[0-9]+-","***-")
Example 2
=REGEXREPLACE(A2,"([A-Z][a-z]+)([A-Z][a-z]+)","$2, $1")
💬 Comments & Q&A 0 approved
🔒 Your comment will be published after review.Share your thoughts — visible after admin approval
No comments yet — be the first!