REGEXMATCH Function in Google Sheets

If you want to check whether a cell’s text matches a pattern, like contains a digit, looks like an email, or starts with certain letters, the REGEXMATCH function in Google Sheets is built for exactly that.

You give it some text and a pattern, and it returns TRUE or FALSE. In this article, I’ll show you how to use REGEXMATCH for digits, email validation, prefixes, case-insensitive matching, and matching any of several words.

REGEXMATCH Function Syntax in Google Sheets

Here is how the REGEXMATCH function is written:

=REGEXMATCH(text, regular_expression)
  • text is the cell or string you want to test.
  • regular_expression is the pattern to look for, written in RE2 syntax and wrapped in double quotes. REGEXMATCH returns TRUE if the pattern is found anywhere in the text, and FALSE if it isn’t.

When to Use REGEXMATCH Function

  • Check whether a cell contains any digit, letter, or symbol.
  • Validate that an entry looks like an email address or a phone number.
  • Test whether text starts with, ends with, or contains a specific prefix.
  • Match text without worrying about uppercase or lowercase.
  • Flag rows that contain any one of several keywords in a single formula.

Example 1: Check If a Cell Contains a Digit

Let’s start with the simplest useful pattern, finding a number anywhere in the text.

Below is the dataset, with text entries in column A across rows 2 to 6. Some contain a digit and some are letters only.

Google Sheets: Text data in column A, empty 'Has Digit' column B for REGEXMATCH.

You want a TRUE or FALSE for each row showing whether it has at least one digit.

Here is the formula:

=REGEXMATCH(A2, "\d")
Google Sheet displaying REGEXMATCH(A2, "\d") formula in B2, checking for digits in text.

The pattern \d means “any single digit.” REGEXMATCH scans the whole cell, and the moment it finds one digit, it returns TRUE.

The first row contains a number, so the result is TRUE. Rows made of letters only come back FALSE, since there’s no digit to find.

Pro Tip: REGEXMATCH looks for the pattern anywhere in the text, not the whole cell. So `\d` is TRUE even if the digit is buried in the middle of a word. Anchor with `^` or `$` when you need a full-string match.

Example 2: Validate an Email Address

A classic use of regex is a sanity check on email entries before you trust them.

Below is the dataset, with entries in column A across rows 2 to 5. Some look like real email addresses and some are missing the parts an email needs.

Google Sheets: "Entry" column A lists emails, "Valid Email" column B is empty.

You want to flag which entries follow a basic email shape.

Here is the formula:

=REGEXMATCH(A2, "^[\w.]+@[\w.]+\.\w+$")
Google Sheets: REGEXMATCH formula shown in B2 validates email entries against a regex pattern.

How this formula works:

  • ^[\w.]+ requires one or more letters, digits, or dots at the start.
  • @ requires an at sign.
  • [\w.]+ requires the domain text.
  • \.\w+$ requires a dot followed by the ending, like com or org, at the very end.

A well-formed address satisfies the whole pattern, so the first row is TRUE. An entry missing the @ or the trailing domain fails and comes back FALSE.

Example 3: Test If Text Starts With a Prefix

Sometimes you only care about how a value begins, like an ID code that should start with PR.

Below is the dataset, with codes in column A across rows 2 to 5. Some start with PR and some don’t.

Google Sheet: Code column A, 'Starts With PR' column B with empty results.

You want to flag the codes that begin with PR.

Here is the formula:

=REGEXMATCH(A2, "^PR")
Google Sheet: B2 shows `=REGEXMATCH(A2, "^PR")` highlighted, yielding TRUE/FALSE results.

The ^ anchor ties the pattern to the start of the string, so ^PR only matches when PR is the very first thing in the cell.

A code that opens with PR returns TRUE. A code starting with anything else returns FALSE, even if PR appears later in the text.

Example 4: Match Without Caring About Case

By default regex is case sensitive. When you want “Urgent”, “urgent”, and “URGENT” to all count, add a case-insensitive flag.

Below is the dataset, with message text in column A across rows 2 to 5. The word urgent appears in different capitalizations.

Google Sheet with 'Subject' column containing text and an empty 'Is Urgent' column.

You want every variation of the word urgent to be flagged, no matter the casing.

Here is the formula:

=REGEXMATCH(A2, "(?i)urgent")
Google Sheets B2 shows REGEXMATCH(A2, "(?i)urgent") evaluating "URGENT review" to TRUE.

The (?i) at the front turns on case-insensitive matching for the rest of the pattern. After that, urgent matches in any casing.

A row containing the word in any form returns TRUE. A row without it returns FALSE. Without (?i), only an exact-case match would count.

Pro Tip: The `(?i)` flag must sit at the start of the pattern. It applies from that point onward, so put it first to make the whole expression case-insensitive.

Example 5: Match Any of Several Words

The pipe character lets you test for a list of keywords in one go, instead of writing several formulas.

Below is the dataset, with text in column A across rows 2 to 6. Some entries mention an animal and some don’t.

Google Sheets: Column A 'Note' has animal phrases; Column B 'Has Pet' is empty.

You want to flag any row that mentions cat, dog, or bird.

Here is the formula:

=REGEXMATCH(A2, "cat|dog|bird")
Google Sheets: REGEXMATCH(A2, "cat|dog|bird") formula highlighted, cell B2 shows TRUE.

The | means “or” in regex, so cat|dog|bird matches if any one of the three words appears.

A row mentioning any of those animals returns TRUE. A row with none of them returns FALSE. This is far tidier than chaining three separate checks, and it pairs well with the MATCH function when you later need the position of a hit.

Tips & Common Mistakes

  • REGEXMATCH errors on an empty cell. If text is blank it returns #N/A, not FALSE. Wrap the cell with a fallback, like =IFERROR(REGEXMATCH(A2,"\d"), FALSE), when blanks are possible.
  • Escape special characters. Symbols like ., +, ?, and ( have meaning in regex. To match a literal dot, write \., otherwise . matches any character.
  • Google Sheets uses RE2, not PCRE. Some lookbehind and backreference tricks from other tools won’t work here. Stick to RE2 syntax to avoid surprises.

REGEXMATCH turns a fuzzy “does this text look right” question into a clean TRUE or FALSE. Once you know a few patterns, you can validate and flag data in seconds.

Start with the simple ones like \d and ^PR, then build up to alternation and case flags as your checks get more specific.

List of All Google Sheets Functions

Related Google Sheets Functions / Articles: