RegexpMatch

Returns True if a string matches a regular expression.

Syntax

RegexpMatch(string, pattern)

Function arguments:

  • string (required): The string to search.
  • pattern (required): The pattern to match within the string.
📘

When the regular expression you want to use contains a slash, quotation or other special character, you will need to use a backslash () to escape the special character.

Notes

  • When any of the arguments are Null, the function returns Null.
  • Regular expressions vary by database. Check the documentation of your data platform for syntax.

Examples

RegexpMatch([Name], "^[A-Z]{1}[a-z]+ [A-Z]{1}[a-z]+$")

Checks if a name starts with an uppercase letter, followed by one or more lowercase letters, and then has another uppercase letter followed by one or more lowercase letters.

In a table with columns Name and RegexpMatch, the string Sigma Computing - capital S and C - returns True and the string sigma computing - lowercase s and c - returns false.
RegexpMatch("123-45-6789", "[0-9]{3}-[0-9]{2}-[0-9]{4}")

Checks if a string matches the social security pattern 'xxx-xx-xxxx'. Returns True.

RegexpMatch([Phone Number], "\\(\\d{3}\\) \\d{3}-\\d{4}")

Checks if a string matches the phone number pattern '(xxx) xxx-xxxx'

In a table with columns Phone Number and RegexpMatch Phone Number, (555) 555-5555 returns True, while 0123456789 returns False
RegexpMatch([Address], "^[0-9]+")

Checks if an address starts with numeric characters.

In a table with columns Address and RegexpMatch, three street addresses that start with numbers all return True