Signature
stock regex_match_simple(const str[], const pattern[], flags = 0, error[] = "", maxLen = 0, &errcode = 0){ new Regex:regex = regex_compile_ex(pattern, flags, error, maxLen, errcode); if(regex < REGEX_OK) { return -1; } new substrings = regex_match_c(str, regex); regex_free(regex); return substrings;}
Description
Matches a string against a regular expression pattern.
Notes
-
If you intend on using the same regular expression pattern
multiple times, consider using compile regex_compile_ex and regex_match*
instead of making this function reparse the expression each time.
Parameters
- str — The string to check.
- pattern — The regular expression pattern.
- flags — General flags for the regular expression.
- error — Error message, if applicable.
- maxLen — Maximum length of the error buffer.
- errcode — Regex type error code encountered, if applicable. See REGEX_ERROR_* defines.
Returns
-2 = Matching error (error code is stored in ret)
-1 = Pattern error (error code is stored in ret)
0 = No match.
>1 = Number of results.