Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

match_regex/3—match a string with a regular  expression


The match_regex/3 function matches a string with a regular  expression. The syntax for this function is as follows:

match_regex($STR,$REGEX,$OPTS)

match_regex/3 arguments

Argument

Mode

Type

Description

$STR

Input

STRING

Specifies the string to be matched

$REGEX

Input

STRING

Specifies the regular expression to match with the string

$OPTS

Input

STRING

Specifies the options for how the regular expression engine operates

Use the match_regex/3 to match a string $STR with regular expression $REGEX applying options specified in $OPTS.

Note

The regular expression $REGEX must be compliant with the Perl Compatible Regular Expression specification. For a specification, see http://perldoc.perl.org/perlre.html.

The value of the $OPTS argument can be either an empty string or a sequence of any of the following option indicators:

Option

Description

i

Perform case insensitive string comparison

m

Multi-line mode

s

A dot matches any character, including new line

x

Extended mode (see below)

In extended mode, blank space data characters in the pattern are ignored, except when they are escaped or inside a character class. Characters between an unescaped # outside a character class and the next new line character, inclusive, are also ignored.

The call of match_regex/3 will succeed if the string matches the regular expression and fail otherwise.

match_regex/3 example

match_regex('2007 02 04 mcell: RULES: xyz',
'[0-9]* [0-9]* [0-9]* [^:]*: [^:]*: .*','');

The input string, which could be part of a trace, matches the regular expression.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*