regex: add/document missing offset param (#1175)
* Regex Little Changes * Prevented to triple and double call `strlen`. * More informative message on `if (offset >= len)`. * Add missing parametr in navite `MatchRegex`. * Regex Little Changes v2 * Using `strdup` instead `strcpy`. * Replaced NULL to nullptr. * Removed note about MatchOffset. Co-Authored-By: Headline <[email protected]> * Removed padding. Co-Authored-By: Headline <[email protected]> * Removed more padding. Co-Authored-By: Headline <[email protected]> Co-authored-by: Headline <[email protected]>
This commit is contained in:
co-authored by
Headline
Headline
parent
2b6833f65d
commit
ded3867605
@@ -199,12 +199,13 @@ native Regex CompileRegex(const char[] pattern, int flags = 0, char[] error="",
|
||||
* @param regex Regex Handle from CompileRegex()
|
||||
* @param str The string to check.
|
||||
* @param ret Error code, if applicable.
|
||||
* @param offset Offset in the string to start searching from.
|
||||
* @return Number of captures found or -1 on failure.
|
||||
*
|
||||
* @note Use the regex handle passed to this function to extract
|
||||
* matches with GetRegexSubString().
|
||||
*/
|
||||
native int MatchRegex(Handle regex, const char[] str, RegexError &ret = REGEX_ERROR_NONE);
|
||||
native int MatchRegex(Handle regex, const char[] str, RegexError &ret = REGEX_ERROR_NONE, int offset = 0);
|
||||
|
||||
/**
|
||||
* Returns a matched substring from a regex handle.
|
||||
|
||||
Reference in New Issue
Block a user