Compile

Compile — compiles a regular expression to a form that is more efficient to evaluate.

Synopsis

static Regex.Compile(pattern, options)
    

Arguments

pattern

A string specifying the regular expression pattern.

options

A bitwise OR of zero or more of the following:

PCRE_ANCHORED
PCRE_BSR_ANYCRLF
PCRE_BSR_UNICODE
PCRE_CASELESS
PCRE_DOLLAR_ENDONLY
PCRE_DOTALL
PCRE_DUPNAMES
PCRE_EXTENDED
PCRE_EXTRA
PCRE_FIRSTLINE
PCRE_JAVASCRIPT_COMPAT
PCRE_MULTILINE
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
PCRE_NEWLINE_ANYCRLF
PCRE_NEWLINE_ANY
PCRE_NO_AUTO_CAPTURE
PCRE_UNGREEDY
PCRE_UTF8
PCRE_NO_UTF8_CHECK

Returns

On success, an instance of Regex. On failure, an error list with three elements:

  • car(errlist) = a numeric return code from the failing function

  • cadr(errlist) = a character position in the pattern where the error occurred, or 0.

  • caddr(errlist) = an error message, as a human-readable string

See Also

Match