REGEXMATCH(text, regular_expression)One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
text:
The text or cell reference that you want to evaluate against the specified regular expression.
regular_expression:
The regular expression pattern that you want to match against the text. This defines the criteria for the match.
The REGEXMATCH function in Google Sheets is a powerful tool used to determine if a text string matches a specified regular expression (regex) pattern. This function is particularly useful for validating data formats, searching for specific patterns within text, or filtering data based on complex criteria. Unlike simpler text functions, REGEXMATCH allows for advanced pattern matching, making it a versatile option for data manipulation.
In simpler terms, REGEXMATCH helps you check if a piece of text fits a certain pattern, which can be incredibly useful for tasks like data validation or extraction.
Imagine you are managing a list of email addresses and you want to validate whether each email is in the correct format.
| Email Address |
|---|
| john.doe@example.com |
| jane.doe@sample |
| invalid-email@.com |
| user123@domain.org |
You want to identify which email addresses are valid based on a standard email format.
To achieve this, you would use the REGEXMATCH function as follows:
=REGEXMATCH(A2, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$")In this formula:
A2 is the cell containing the email address you want to validate."^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" is the regex pattern that defines a valid email format.When you apply the REGEXMATCH formula to the Email List, the output would look like this:
| Email Address | Valid? |
|---|---|
| john.doe@example.com | TRUE |
| jane.doe@sample | FALSE |
| invalid-email@.com | FALSE |
| user123@domain.org | TRUE |
In this case, the formula returns TRUE for valid email addresses and FALSE for those that do not match the specified pattern.
REGEXMATCH is beneficial because it provides a robust way to validate and filter data based on complex patterns. It eliminates the need for multiple nested functions and offers a more efficient method for checking data integrity. Additionally, it allows for flexibility in defining patterns, making it suitable for various applications beyond just email validation.
REGEXMATCH is an essential function for anyone working with data in Google Sheets, providing a powerful way to enhance data validation and analysis capabilities.
Happy spreadsheeting!
You have a list of product codes in Column A and want to identify which codes are valid based on a specific pattern. Using REGEXMATCH, you can quickly filter and highlight valid codes, ensuring accurate inventory management without manual checks.
Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.
Browse our complete library of Google Sheets 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.