These functions facilitate regular expression functionality as it is provided by ICU http://site.icu-project.org/. More...
Typedefs | |
typedef enum ruRegexFlag_ | ruRegexFlag |
Constants for Regular Expression Match Modes. More... | |
typedef void * | ruRegex |
Opaque pointer to regular expression object. More... | |
Enumerations | |
enum | ruRegexFlag_ { RUREGEX_NULL = 0 , RUREGEX_CANON_EQ = 128 , RUREGEX_CASE_INSENSITIVE = 2 , RUREGEX_COMMENTS = 4 , RUREGEX_DOTALL = 32 , RUREGEX_LITERAL = 16 , RUREGEX_MULTILINE = 8 , RUREGEX_UNIX_LINES = 1 , RUREGEX_UWORD = 256 , RUREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512 } |
Constants for Regular Expression Match Modes. More... | |
Functions | |
RUAPI ruRegex | ruRegexFree (ruRegex rr) |
Frees up the resources of the given ruRegex object. More... | |
RUAPI ruRegex | ruRegexNew (const char *pattern, ruRegexFlag flags, int32_t *code) |
Creates a new regular expression object to be used with ruRegex(Replace|Match|...) free with ruRegexFree after use. More... | |
RUAPI char * | ruRegexReplace (ruRegex rr, const char *original, const char *replacement, int32_t *code) |
Replace the found expression instances in original with the content found in replacement and return the result. More... | |
RUAPI bool | ruRegexMatch (ruRegex rr, const char *original, int32_t *code) |
Indicates whether the given original matches the entire expression in rr. More... | |
RUAPI bool | ruRegexFind (ruRegex rr, const char *original, int32_t *code) |
Indicates whether the given original matches the part of the expression in rr. More... | |
RUAPI ruList | ruRegexMatchGroups (ruRegex rr, const char *original, int32_t *code) |
Returns the matches found in the given original if it matched the entire expression in rr. More... | |
RUAPI ruList | ruRegexFindGroups (ruRegex rr, const char *original, int32_t *code) |
Returns the matches found in the given original if it matched part of the expression in rr. More... | |
These functions facilitate regular expression functionality as it is provided by ICU http://site.icu-project.org/.
Example:
typedef void* ruRegex |
Opaque pointer to regular expression object.
typedef enum ruRegexFlag_ ruRegexFlag |
Constants for Regular Expression Match Modes.
These are mirrored from ICU to avoid having to pull the entire includes folders when using regify-utils.
enum ruRegexFlag_ |
Constants for Regular Expression Match Modes.
These are mirrored from ICU to avoid having to pull the entire includes folders when using regify-utils.
Enumerator | |
---|---|
RUREGEX_NULL | Represents no flags when passing this type as a parameter. |
RUREGEX_CANON_EQ | Forces normalization of pattern and strings. Not implemented yet, just a placeholder, hence draft. |
RUREGEX_CASE_INSENSITIVE | Enable case insensitive matching. |
RUREGEX_COMMENTS | Allow white space and comments within patterns |
RUREGEX_DOTALL | If set, '.' matches line terminators, otherwise '.' matching stops at line end. |
RUREGEX_LITERAL | If set, treat the entire pattern as a literal string. Metacharacters or escape sequences in the input sequence will be given no special meaning. The flag RUREGEX_CASE_INSENSITIVE retains its impact on matching when used in conjunction with this flag. The other flags become superfluous. |
RUREGEX_MULTILINE | Control behavior of "$" and "^" If set, recognize line terminators within string, otherwise, match only at start and end of input string. |
RUREGEX_UNIX_LINES | Unix-only line endings. When this mode is enabled, only \u000a is recognized as a line ending in the behavior of ., ^, and $. |
RUREGEX_UWORD | Unicode word boundaries. If set, uses the Unicode TR 29 definition of word boundaries. Warning: Unicode word boundaries are quite different from traditional regular expression word boundaries. See http://unicode.org/reports/tr29/#Word_Boundaries |
RUREGEX_ERROR_ON_UNKNOWN_ESCAPES | Error on Unrecognized backslash escapes. If set, fail with an error on patterns that contain backslash-escaped ASCII letters without a known special meaning. If this flag is not set, these escaped letters represent themselves. |
RUAPI bool ruRegexFind | ( | ruRegex | rr, |
const char * | original, | ||
int32_t * | code | ||
) |
Indicates whether the given original matches the part of the expression in rr.
rr | The ruRegex object to use. |
original | The source string to match. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |
Returns the matches found in the given original if it matched part of the expression in rr.
rr | The ruRegex object to use. |
original | The source string to match. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |
Frees up the resources of the given ruRegex object.
rr | object to free. |
RUAPI bool ruRegexMatch | ( | ruRegex | rr, |
const char * | original, | ||
int32_t * | code | ||
) |
Indicates whether the given original matches the entire expression in rr.
rr | The ruRegex object to use. |
original | The source string to match. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |
Returns the matches found in the given original if it matched the entire expression in rr.
rr | The ruRegex object to use. |
original | The source string to match. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |
RUAPI ruRegex ruRegexNew | ( | const char * | pattern, |
ruRegexFlag | flags, | ||
int32_t * | code | ||
) |
Creates a new regular expression object to be used with ruRegex(Replace|Match|...) free with ruRegexFree after use.
pattern | The pattern representing the regular expression without delimiters. |
flags | Flags influencing the behavior of the expression. These are from ICU and we provide ruRegexFlag. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |
RUAPI char* ruRegexReplace | ( | ruRegex | rr, |
const char * | original, | ||
const char * | replacement, | ||
int32_t * | code | ||
) |
Replace the found expression instances in original with the content found in replacement and return the result.
rr | The ruRegex object to use. |
original | The source string to replace |
replacement | The replacement string for found matches in original. |
code | (Optional) Where the return result of this operation such as RUE_OK on success will be stored. |