msys.policyeditor.pcre_match

March 26, 2020 Contributors

Name

msys.policyeditor.pcre_match — Perform a PCRE regex match operation

Synopsis

msys.policyeditor.pcre_match(ctx, vars, params);

ctx: table
vars: table
params: table

**Configuration Change. ** This function is deprecated. Use local str = msys.pcre.match("string", "pattern") to perform a PCRE match. For more information see msys.pcre.match.

Description

Perform a PCRE regex match operation.

A side effect of operation is that the variable $0 is set to the subject string, $1 is set to the first capturing subexpression, $2 the second and so on. Additionally, if you use one of the various forms of named subexpression captures, such as (?P<name>\d+), then the name of each captured item will be prefixed with a dollar sign and set as a script variable (so you’d have $name if you used (?P<name>\d+)).

The ctx parameter is the context containing objects from the callout, vars is a table containing script variables and params is a table containing parameters to be passed to this routine.

Defined parameters for params are:

  • subject the string to be matched

  • pattern the PCRE regex pattern to match against

See Also

“Using Regular Expressions with the Policy Editor”