No: Excel’s standard Find and Replace dialog does not interpret regular expressions. In Microsoft 365, use the REGEXREPLACE worksheet function to create regex-based replacements in a helper column, then copy the results back as values if you need to replace the original data.
What Excel’s Find and Replace supports
On Windows, open the replacement dialog from Home > Find & Select > Replace, or press Ctrl+H. The dialog can find text, numbers, and certain patterns, but its pattern option is wildcard matching—not regex. Turning on the Use wildcards option under Options does not make regular-expression syntax available.
Excel wildcards are deliberately simple. An asterisk matches any number of characters, a question mark matches one character, and a tilde escapes a wildcard so you can search for it literally. For example, a wildcard search for north* can match “north,” “northern,” or “north branch.” It cannot use regex features such as character classes, alternation, capture groups, or repetition quantifiers.
This distinction matters because similar-looking symbols have different meanings. In regex, a period usually means “any character,” while in Excel’s wildcard search it is a literal period. A regex pattern such as \d+ means one or more digits; Excel’s Find and Replace dialog does not understand that expression.
Use REGEXREPLACE in Microsoft 365
For regex-based changes in a worksheet, enter REGEXREPLACE in a formula. Its basic syntax is REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity]). The pattern is a regular expression, and the replacement is the text to put in its place. The optional occurrence argument can limit which match is changed; the optional case-sensitivity argument controls whether matching distinguishes uppercase from lowercase.
Microsoft 365’s regex functions use the PCRE2 regular-expression engine. They are available in supported Microsoft 365 versions of Excel, including Excel for the web and Excel for Mac; availability can depend on the update channel and build. If Excel reports that REGEXREPLACE is an unrecognized function, update Microsoft 365 or check whether your organization’s update settings have delayed the feature. Older perpetual-license versions of Excel do not necessarily include these functions.
A formula returns a result in a cell; it does not edit the source cell in place like the Replace command. That difference is central to the workflow. Keep the original column, calculate cleaned text in another column, review the output, and then decide whether to retain both columns or replace the source values with pasted results.
Practical regex replacement examples
With the text to clean in A2, enter this formula in B2 to remove every run of digits. For the example value “Order 5482 pending,” the result is “Order pending,” with the two spaces left around the removed number.
With the source value in A2 and the formula in B2, remove each sequence of one or more digits using:
=REGEXREPLACE(A2,"[0-9]+","")
To remove punctuation and spaces from a phone number while keeping its digits, use a negated character class. With A2 containing “(206) 555-0148,” the result is “2065550148.”
With the phone number in A2 and the formula in B2, keep only characters from 0 through 9:
=REGEXREPLACE(A2,"[^0-9]","")
To reduce repeated whitespace to one ordinary space, use the whitespace class and a plus sign. With A2 containing “Mira Chen” (three spaces between the names), the result is “Mira Chen.” This can also match tabs and other whitespace characters, not just typed spaces.
With the text in A2 and the formula in B2, replace each run of whitespace with one space:
=REGEXREPLACE(A2,"\s+"," ")
Capture groups let you rearrange parts of a match. For example, if A2 contains “Chen, Mira,” this pattern captures the surname and given name separately and returns “Mira Chen.” The replacement uses $1 and $2 to refer to the captured groups.
With a value in A2 formatted as a word, comma, optional spaces, and another word, use this formula in B2:
=REGEXREPLACE(A2,"^([A-Za-z]+),\s*(.+)$","$2 $1")
These are text transformations, not data validation. A pattern that rearranges names assumes the input follows the stated format; it may not handle multi-part surnames, suffixes, or names with punctuation as intended. Inspect representative results before applying a pattern to an entire column.
Apply replacements to a whole column safely
Use a helper column so the source remains available for comparison. Put the formula beside the first data row, fill it down, and check both ordinary cases and edge cases such as blank cells, punctuation, repeated separators, and unexpected formats. Then choose how to use the output:
- Keep the formula column: Useful when source values may change and you want the cleaned results to update automatically.
- Replace the original values: Copy the completed formula results, select the destination range, and use Paste Special > Values. This replaces formulas with their displayed text results.
- Retain an audit trail: Keep the source column and label the cleaned column clearly, especially when the transformation removes information.
Before overwriting source data, save a copy of the workbook or duplicate the worksheet. Removing characters can be irreversible once the original values are discarded. Also check whether leading zeroes matter: Excel may treat codes as numbers in some workflows, while regex replacement operates on text representations. For identifiers such as postal codes or product codes, preserve them as text when leading zeroes are significant.
Regex versus Excel wildcards
For a quick search-and-replace based on a simple prefix or a single unknown character, Excel wildcards may be enough. In the Replace dialog, select Options and enable Use wildcards, then use * or ? in the Find what box. This operates directly in the selected cells and is often faster for a one-time, uncomplicated change.
Choose regex formulas when the pattern has rules that wildcards cannot express: “one or more digits,” “a letter followed by three digits,” alternative spellings, or rearranged sections of text. Regex also makes the pattern reusable in a formula and easier to apply consistently to many rows. The trade-off is that formulas produce results in cells rather than performing a direct in-place edit, and complex patterns can be difficult to maintain.
For literal replacements, use the ordinary Replace dialog rather than writing a formula. For a complex transformation that must be repeated on imported data, consider a documented regex formula, a suitable add-in, or a custom automation approach. Choose the simplest method that meets the requirement; a powerful pattern is not automatically safer or clearer.
Common problems and how to avoid them
- Excel says the function name is invalid: REGEXREPLACE requires a supported Microsoft 365 version. Check for updates and confirm that your Excel installation has received the feature.
- The result is blank or unexpected: Check that the pattern actually matches the cell text. Anchors such as
^and$require a match at the beginning or end of the text, respectively. - Backslashes seem confusing: In a worksheet formula, regex syntax is inside a quoted text string. For example, the regex token
\sappears as"\s"in the formula; the backslash is part of the pattern. - Only part of the text changed: A pattern may match only one occurrence, or the optional occurrence argument may specify a particular match. Check the function’s arguments and test with a cell containing several matching pieces.
- Uppercase and lowercase behave differently: Review the function’s case-sensitivity setting and the character classes in the pattern. Do not assume that a pattern matches every capitalization unless its settings say so.
- The replacement deletes too much: A broad pattern such as
.*can match a large portion of a string. Test on sample cells before filling the formula down, and preserve the source data.
Formula separators can also vary by regional settings. The examples here use commas, as requested for standard English-language Excel syntax. If your Excel installation expects semicolons between function arguments, use the separator shown by that installation when entering the formula.
Other ways to do regex replacements
If you need a direct replacement rather than a helper column, Excel’s dialog itself remains limited to its built-in search options. A VBA macro or an add-in can provide a custom regex workflow, but the exact behavior depends on the code or product. Macros can change many cells at once, so review the code, use a copy of the workbook, and confirm the target range before running them.
Power Query is useful for repeatable data-cleaning steps, but its standard Replace Values interface is not a general regex replacement dialog. It can handle many transformations through its built-in tools and M language, while regex generally requires a separate implementation or connector. Do not assume that an ordinary Power Query replace step accepts regex syntax just because it accepts text.
For most Microsoft 365 users, REGEXREPLACE is the simplest built-in route when the change is genuinely pattern-based. If the data is small and the pattern is simple, wildcard Find and Replace may be quicker. If the process must run repeatedly on incoming files, choose a method that can be documented, tested, and rerun without manually editing each batch.
Frequently Asked Questions
Can I use regex directly in Excel’s Ctrl+H dialog?
No. Ctrl+H opens Find and Replace on Windows, but its pattern option is wildcard matching, not regular expressions. Use REGEXREPLACE in a supported Microsoft 365 version for regex-based transformations.
Does Excel Find and Replace support wildcards?
Yes. Open Options in the Replace dialog and enable Use wildcards. The asterisk matches any number of characters, the question mark matches one character, and a tilde can escape a wildcard character. These rules are not the same as regex syntax.
Can REGEXREPLACE change the original cell directly?
No. It returns the transformed text in the formula cell. Use a helper column, review the results, then copy and paste the results as values over the original cells if that is what you intend.
Does REGEXREPLACE work in older Excel versions?
It is a Microsoft 365 function, and availability depends on a supported app version and update. If your installation does not recognize it, update Excel or use an alternative such as a suitable add-in or custom VBA solution.
Can regex validate an email address in Excel?
A regex can check whether text fits a chosen pattern, but that does not prove an address exists or can receive mail. Email address rules are more complicated than many simple patterns allow, so treat a regex check as a formatting screen rather than definitive verification.
Related
- Excel Freeze Panes: Change Them While Scrolling?
- Excel Cannot Open the File: Causes, Checks, and Fixes
- Excel Box Plot With Data Points: How to Show Every Value
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Set an Out of Office in OutlookTo set an out-of-office email in Outlook, open Automatic replies, turn them on, write your message, and—if available—choose…
- How to Double Space in Microsoft Word on Any DeviceTo double-space text in Microsoft Word, select the text—or press Ctrl+A on Windows or Command+A on Mac to…
- How to Insert a Signature in Word 365: Image, Line, or InkTo insert a handwritten signature in Word 365, scan or photograph it, save it as an image, then…
- Google Sheets Day of Week: Formula and ExamplesTo get a day-of-week number in Google Sheets, use WEEKDAY; for example, with a date in A2 and…
- How to Merge Cells in Excel and Keep All TextTo merge cells in Excel and keep all their text, first join the contents with a formula such…
- How to Add a New Item to an Excel Dropdown List Step by StepTo add a choice to an Excel dropdown, update the list that supplies its options, then confirm the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.