0PricingLogin
Excel Formulas Academy · Lesson

Testing Patterns With REGEXMATCH

Check whether text matches a pattern and return TRUE or FALSE.

Why Patterns Beat Plain Search

Sometimes you do not want to check for one exact word. You want to ask a smarter question like does this cell contain any digits? or is this a valid email shape?

A regular expression (regex) is a tiny pattern language that describes the shape of text. Google Sheets lets you use it through three functions: REGEXMATCH, REGEXEXTRACT, and REGEXREPLACE.

In this lesson we focus on the first one. REGEXMATCH simply answers a yes or no question: does the text match the pattern?

The REGEXMATCH Syntax

REGEXMATCH takes two arguments: the text to check and the pattern to look for. It returns TRUE if the pattern is found anywhere in the text, otherwise FALSE.

Note: this function lives in Google Sheets. Excel uses different tools, so we are firmly in Sheets territory here.

The simplest pattern is just a piece of literal text. The formula below checks if cell A2 contains the word cat.

=REGEXMATCH(A2, "cat")

All lessons in this course

  1. Testing Patterns With REGEXMATCH
  2. Pulling Out Patterns With REGEXEXTRACT
  3. Replacing Patterns With REGEXREPLACE
  4. Splitting and Cleaning Messy Data
← Back to Excel Formulas Academy