SpreadsheetFormulas
intermediateREGEXMATCHISNUMBERSEARCH

Flag Rows That Match a Text Pattern With REGEXMATCH

Your customer list mixes company emails with personal Gmail addresses, and you need a TRUE/FALSE flag on each row so you can filter, count, or clean them up.

Quick formula
=REGEXMATCH(A2,"@gmail\.com$")
Sample input
1EmailCustomer
2ana@acmeco.comAcme Co
3ben.okafor@gmail.comBorealis
4cara@northmail.comCobalt
Result
1EmailPersonal Gmail?
2ana@acmeco.comFALSE
3ben.okafor@gmail.comTRUE
4cara@northmail.comFALSE

Excel & Google Sheets

=ISNUMBER(SEARCH("@gmail.com",A2))

How it works

REGEXMATCH is Google Sheets only: it returns TRUE if any part of the cell matches the regular expression. Two characters do the precision work here — the backslash escapes the dot, because in regex a bare . matches any character (so @gmail.com would also match ana@gmailXcom), and the $ anchors the pattern to the end of the text, so an address ending in @gmail.com.br won't sneak through. Excel's classic functions have no regex at all; the nearest equivalent is =ISNUMBER(SEARCH("@gmail.com",A2)), which finds the literal text anywhere in the cell — close, but it can't anchor to the end and treats the dot literally rather than as a pattern. Also note REGEXMATCH is case-sensitive: wrap the cell in LOWER, or start the pattern with (?i), if your data mixes cases.

A2
The cell to test — an email address here.
"@gmail\.com$"
The pattern: literal @gmail.com (dot escaped) that must sit at the very end of the text ($).

When to use it

Use it whenever "contains this text" isn't precise enough: flag free-mail domains in a CRM export, catch order IDs that don't match your SKU format, or spot invoice references with stray characters.

Common mistakes

  • Forgetting to escape the dot.

    In regex, . matches any character — "@gmail.com" happily matches "@gmailXcom". Escape it: "@gmail\.com".

  • Case-sensitive misses.

    "@Gmail.com" returns FALSE against a lowercase pattern. Use =REGEXMATCH(LOWER(A2),"@gmail\.com$") or prefix the pattern with (?i).

  • Typing REGEXMATCH into Excel.

    Excel shows #NAME? — it has no regex functions. The fallback =ISNUMBER(SEARCH("@gmail.com",A2)) matches literal text anywhere in the cell (case-insensitive), but it is not a real regex: no anchors, no character classes.

Did this formula help?

Engine-verified against the sample data aboveLast reviewed 2026-07-08