native

regex_compile

Syntax

native Regex:regex_compile(const pattern[], &ret, error[], maxLen, const flags[]="");

Description

Precompile a regular expression. Use this if you intend on using the
same expression multiple times. Pass the regex handle returned here to
regex_match_c to check for matches.

Parameters

pattern The regular expression pattern.
errcode Error code encountered, if applicable.
error Error message encountered, if applicable.
maxLen Maximum string length of the error buffer.
flags General flags for the regular expression.
i = Ignore case
m = Multilines (affects ^ and $ so that they match
the start/end of a line rather than matching the
start/end of the string).
s = Single line (affects . so that it matches any character,
even new line characters).
x = Pattern extension (ignore whitespace and # comments).

Return

-1 on error in the pattern, > valid regex handle (> 0) on success.

Note

This handle is automatically freed on map change. However,
if you are completely done with it before then, you should
call regex_free on this handle.