Functions

regex.inc

Function Type Description
regex_compile native Precompile a regular expression.
regex_compile_ex native Precompile a regular expression.
regex_free native Frees the memory associated with a regex result, and sets the handle to 0.
regex_match native Matches a string against a regular expression pattern.
regex_match_all native Matches a string against a regular expression pattern, matching all occurrences of the
pattern inside the string. This is similar to using the "g" flag in perl regex.
regex_match_all_c native Matches a string against a pre-compiled regular expression pattern, matching all
occurrences of the pattern inside the string. This is similar to using the "g" flag
in perl regex.
regex_match_c native Matches a string against a pre-compiled regular expression pattern.
regex_replace native Perform a regular expression search and replace.

An optional parameter, flags, allows you to specify options on how the replacement is performed.
Supported format specifiers for replace parameter:
$number : Substitutes the substring matched by group number.
n must be an integer value designating a valid backreference, greater than 0, and of two digits at most.
${name} : Substitutes the substring matched by the named group name (a maximum of 32 characters).
$& : Substitutes a copy of the whole match.
$` : Substitutes all the text of the input string before the match.
$' : Substitutes all the text of the input string after the match.
$+ : Substitutes the last group that was captured.
$_ : Substitutes the entire input string.
$$ : Substitutes a literal "$".
As note, the character \ can be also used with format specifier, this is same hehavior as $.
regex_substr native Returns a matched substring from a regex handle.
regex_match_simple stock Matches a string against a regular expression pattern.