match_regex

Description

Return true if the argument input string or object (converted to a string) matches the argument regular expression. The last parameter specifies optional regex flags:

  • c - Enables case-sensitive matching (default.)

  • i - Enables case-insensitive matching.

  • m - Enables multi-line mode (i.e. meta-characters ^ and $ match the beginning and end of any line of the input string.) By default, multi-line mode is disabled (i.e. ^ and $ match the beginning and end of the entire input string.)

  • s - Enables the POSIX wildcard character . to match \n (newline.) By default, . does not match \n.

For more about syntax, see POSIX extended regular expressions.

Return type

bool

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

match_regex( input_string, pattern [ , flags ] )

Argument

Type

Required

Multiple

input_string

string

Required

Only one

pattern

regex

Required

Only one

flags

string

Optional

Only one

match_regex( input_object, pattern [ , flags ] )

Argument

Type

Required

Multiple

input_object

object

Required

Only one

pattern

regex

Required

Only one

flags

string

Optional

Only one

Examples

filter match_regex(log, /^debug/, 'i')

Filter field log for results matching the specified regular expression, using case-insensitive matching.

Aliases

regex_match (deprecated)