Google Sheets REGEXMATCH Function

This post will guide you how to use Google Sheets REGEXMATCH function with syntax and examples.

Description


The Google Sheets REGEXMATCH function is to check whether a piece of text matches a regular expression.

The REGEXMATCH function can be used to check whether a substring from a text string matches a given regular expression in google sheets. And it returns a logic value, TRUE or FALSE.

The REGEXMATCH function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the REGEXMATCH function is as below:

= REGEXMATCH (text, regular_expression)

Where the REGEXMATCH function arguments are:

  • text -This is a required argument. The text string that you want to extract a substring based on regular expression.
  • regular_expression – This is a required argument. The Regular_expression is a regular expression. It can be used to match the part of the text that you want to extract. The regular expression argument should be entered in double-quote characters.

Note: 

  • The REGEXMATCH function takes two arguments. It checks whether a piece of text matches a given regular expression.
  • The REGEXMATCH function only works with text value as its first argument and returns a text result. If you wish to return a numeric value, and you need to use VALUE function in combination with the REGEXEXTRACT function. If the input value is a number, and you can use the TEXT function to convert them.
  • Google Sheets supports RE2 for regular expressions.

Google Sheets REGEXMATCH Function Examples


The below examples will show you how to use google sheets REGEXMATCH function to extract a substring from a text according to a regular expression.

#1 Check if text value in Cell B1 matches a given regular expression, using the REGEXMATCH function with a regular expression “google” , type:

= REGEXMATCH (B1,"google") //it returns “TRUE”

google sheets regexmatch function

#2 Check if text value in cell B1 matches either of the words in a sentence using REGEXMATCH function with a regular expression “google|sheets” , type:

=REGEXMATCH(B1,"google|sheets") // it returns “TRUE”

google sheets regexmatch function

#3 Check if text value in Cell B1 matches any number of decimal digits using REGEXMATCH function with a regular expression “\d+” , type:

= REGEXMATCH(B1,"\d+") // it returns “TRUE”

google sheets regexmatch function

#4 Check if text value in Cell B1 matches any specific decimal digits using REGEXMATCH function with a regular expression “[2-3]” , type:

= REGEXMATCH(B1,"[2-3]") // it returns “TRUE”

google sheets regexmatch function

 

 

 

 

 

 

Related Posts

Assigning Points based on Late Time in Google Sheets

It is shown in this lesson how to utilize the IF function in Excel to allocate points based on the amount of time that has passed. If you intend to pursue along this guide, you may do so by downloading ...

Google Sheets COUNTBLANK Function

This post will guide you how to use Google Sheets COUNTBLANK function with syntax and examples. Description The Google Sheets COUNTBLANK function use to count the number of empty cells in a range of cells. You can use the COUNTBLANK ...

Google Sheets DEGREES Function

This post will guide you how to use Google Sheets DEGREES function with syntax and examples. Description The Google Sheets DEGREES function converts radians into degrees. And it will return a numeric value. For examples, if you pass the PI() function into ...

Google Sheets COSH Function

This post will guide you how to use Google Sheets COSH function with syntax and examples. Description The Google Sheets COSH function returns the hyperbolic cosine of a given angle. The purpose of this function is used to get hyperbolic ...

Google Sheets COS Function

This post will guide you how to use Google Sheets COS function with syntax and examples. Description The Google Sheets COS function returns the cosine of a given angle. If you want to supply an angle to COS function in ...

Sidebar