Name

matches — Tests if a string matches with a regular expression.

Syntax

matches(string, regexp)
              

The MATCHES function has the following arguments:

string

The string to matches against the regular expression.

regexp

The regular expression to be used for matching.

Description

Tests if a string matches a regular expression. This function returns true if the string matches, and false otherwise.

See the section on Regular expressions for a description of the matching patterns.

Examples

Formula

Description

Result

matches('foobar', 'foo.*')

Test if 'foobar' matches to 'foo.*'

true

matches('foobar', '(foo|glue)bar')

Test if 'foobar' matches to '(foo|glue)bar'

true

matches('FooBar', '(?i)foo.*')

Test if 'FooBar' matches to '(?i)foo.*' using case-insensitive matching.

true