HomeGoogle DocsSpreadsheetHow to Use REGEXMATCH Function in Google Sheets

How to Use REGEXMATCH Function in Google Sheets

Published on

Google Sheets REGEX functions are pure text functions. Among the three REGEX functions, I’ve already explained the use of REGEXEXTRACT. Other two REGEX functions are REGEXMATCH and REGEXREPLACE. Here we can learn how to use REGEXMATCH function in Google Sheets.

Learning REGEXMATCH is important as you can use this in combined or nested form with functions like FILTER for logical tests. REGEXMATCH returns Boolean TRUE or FALSE.

Many users skip the REGEX functions due to the lack of tutorials or guidance. Because this function contains RE2 regular expressions, which may be new to many and also seems complicated. With this tutorial, I wish I could shed some light on the usage of REGEX formula.

Google Sheets REGEXMATCH Function

Here I’m going to provide you a good exposure to the use of REGEXMATCH with the help of examples. Below are the purpose and syntax.

Purpose of REGEXMATCH Formula

The purpose of this function is to find whether a piece of text matches a regular expression. When you go through the examples below, you can understand it clearly.

Syntax

REGEXMATCH(text, regular_expression)
text  is the ‘text’ to be tested against the regular expression.
regular_expression – The regular expression to test the text against.

Example to REGEXMATCH Function

1. Regexmatch to match any plain text in a word, phrase or sentence.

Text in Cell A2: Info Inspired 2017, India

Formula:

=REGEXMATCH(A2, "Info Inspired")

Result: TRUE

Text in Cell A3: InfoInspired 2017, India

Formula:

=REGEXMATCH(A3, "Info Inspired")

Result: FALSE

Text in Cell A4: Info inspired 2017, India

Formula:

=REGEXMATCH(A3, "Info Inspired")

Result: FALSE

2. Regexmatch to match the presence of either of the single character in a word, phrase or sentence, Similar to “this or that”.

Text in Cell A4: Info Inspired 2017, India

Formula:

=REGEXMATCH(A4, "y|o")

Result: TRUE

Formula:

=REGEXMATCH(A4, "b|z")

Result: FALSE

3. Regexmatch to match either of the words in a sentence.

Text in Cell A8: Info Inspired 2017, India

Formula:

=REGEXMATCH(A8, "blog|India")

Result: TRUE

4. Regexmatch to match whether the text contains a specific number of characters.

Text in Cell A9: Info Inspired 2017, India

Formula:

=REGEXMATCH(A9, "...")

Result: TRUE

Another variation of the above Match.

=REGEXMATCH(A9, "Ins...")

Text in Cell A9: Cloud

Formula:

=REGEXMATCH(A9, ".......")

Result: FALSE

5. Regexmatch to match the presence of any number of decimal digits in the text.

Text in Cell A11: Info Inspired 2017, India

Formula:

=REGEXMATCH(A11, "(\d)")

Result: TRUE

6. Regexmatch to match the presence of any specific decimal digits in the text.

Text in Cell A12: ABC6

Formula:

=REGEXMATCH(A12, "[5-9]")

Result: TRUE

7. Regexmatch to match any of the specific characters.

Text in Cell A13: Info Inspired 2017, India

Formula:

=REGEXMATCH(A13, "[dxy]")

Result: TRUE

8. Regexmatch to match the presence of any small case letters.

Text in Cell A14: D

Formula:

=REGEXMATCH(A14, "[a-c]")

Result: FALSE

9. Regexmatch to match the presence of any UPPER case letters.

Text in Cell A15: D

Formula:

=REGEXMATCH(A15, "[A-Z]")

Result: TRUE

10. Regexmatch to match any content between question marks.

Text in Cell A16: Can you find this ?Content? between question marks

Formula:

=REGEXMATCH(A16, "\?([A-Za-z]+)\?")

Result: TRUE

11. Regexmatch to match any content between brackets.

Text in Cell A17: HI (Content) between question marks

Formula:

=REGEXMATCH(A17, "\(([A-Za-z]+)\)")

Result: TRUE

12. Regexmatch to match any email address.

Text in Cell A18: email me <info@infoinspired.com>

Formula:

=REGEXMATCH(A18, "<(.+)>")

Result: TRUE

13. Regexmatch to Exact Match a String.

Text in Cell A19: student 19

Formula:

REGEXMATCH(A19,"^student 1$")

Result: FALSE

If you change the string to student 1, then the formula would return TRUE.

Related: Regexmatch in Filter Criteria in Google Sheet

Conclusion:

Hope you could learn the use of REGEXMATCH in Google Sheets. You can feel free to check our ultimate Google Sheets Function guide to learn all Google Sheets trendy functions.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

SUMPRODUCT Differences: Excel vs. Google Sheets

The core purpose of the SUMPRODUCT function remains consistent across both Excel and Google...

Sum Values by Month and Category in Excel

With the help of EOMONTH, UNIQUE, and SUMIFS functions in Excel, you can efficiently...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

5 COMMENTS

  1. I have tried the examples here in relation to a workbook I am using and they all return parse errors.

    Any suggestions as to where to check appreciated.

  2. I want to match inside query the expression: 6.1)

    How can I do that, I’ve tried:

    matches '6.1)' – not working

    matches '\6.1\)' – not working

    matches '\6.1)\)' – not working

    Please help

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.