Returns true if the target value exactly matches the regular expression pattern.
Sample usage
REGEXP_MATCH(name, '[a-zA-Z].*')
Syntax
REGEXP_MATCH(X, regular_expression)
Parameters
X
- a field or expression to evaluate.-
regular_expression
- a regular expression.
Returns
The REGEXP_MATCH
function returns Boolean data type values.
Notes
Looker Studio uses the RE2 expression syntax. For more details, see Regular Expressions in Looker Studio.
Note that patterns containing escape characters such as \
may require additional escaping in Looker Studio, which can be avoided with the use of raw string literals.
Examples
Example formula | Input | Output |
---|---|---|
REGEXP_MATCH(field_expression, 'A') |
ABC123 | false |
REGEXP_MATCH(field_expression, 'A.*') |
ABC123 | true |
REGEXP_MATCH(name, '[a-zA-Z].*') |
Sam | true |
REGEXP_MATCH(name, '[a-zA-Z].*') |
$am | false |
REGEXP_MATCH(country, '(USA|Canada|Mexico)') |
Canada | true |
REGEXP_MATCH(country, '(USA|Canada|Mexico)') |
Brazil | false |