=REGEXREPLACE(text, regular_expression, replacement)One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
Need more than a single REGEXREPLACE formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.
text:
The input text or cell reference that you want to search and modify using the regular expression.
regular_expression:
The pattern that defines the search criteria for the text. This is a string that specifies the regular expression to match against the text.
replacement:
The text that will replace the matched portions of the text based on the regular_expression.
The REGEXREPLACE function in Excel is a powerful tool that allows you to replace text in a string based on a regular expression pattern. It evaluates a given text, searches for a specified pattern, and replaces it with a new string if the pattern is found.
In simpler terms, the REGEXREPLACE function helps you manipulate text data by finding and replacing specific patterns, making it easier to clean and format your data.
Imagine you are working with a list of email addresses in an Excel spreadsheet, and you have the following data:
You want to replace the domain "example.com" with "newdomain.com" for all email addresses.
To replace the domain for the email addresses, you would use the REGEXREPLACE formula as follows:
=REGEXREPLACE(A2, "@example\.com$", "@newdomain.com")\ is used to escape the dot, and $ indicates the end of the string.When you apply the formula, it replaces the domain "example.com" with "newdomain.com" for the email addresses. The output would be:
Here, the email addresses for Alice, Bob, and Eve have been updated, while Charlie and David remain unchanged since their domains do not match.
The REGEXREPLACE function is particularly useful when you need to perform complex text manipulations based on patterns without manually editing each entry. It allows you to quickly clean and format data, making it easier to prepare datasets for analysis.
Understanding how to use the REGEXREPLACE function can significantly enhance your data manipulation capabilities in Excel, enabling you to efficiently clean and format your datasets.
Happy replacing!
You have a dataset in Column A that contains email addresses of customers, but some entries have inconsistent formatting, such as extra spaces or incorrect casing. You can use the REGEXREPLACE function to clean up these email addresses by removing extra spaces and converting them to lowercase. This ensures that all email addresses are standardized, making it easier to manage customer communications and maintain a clean database without the need for manual corrections.
Beyond the REGEXREPLACE function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.
Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.
Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.
Browse our complete library of Excel formula guides
Compare your options
Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.
AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.