SimpleRegexMatch Function

Matches a string against a regular expression pattern.

int SimpleRegexMatch(const char[] str, const char[] pattern, int flags, char[] error, int maxLen)

Parameters

const char[] str

The string to check.

const char[] pattern

The regular expression pattern.

int flags

General flags for the regular expression.

char[] error

Error message, if applicable.

int maxLen

Maximum length of the error buffer.

Return Value

Number of substrings found or -1 on failure.

Notes

If you intend on using the same regular expression pattern multiple times, consider using CompileRegex and MatchRegex instead of making this function reparse the expression each time.