Previous: regexps groups, Up: regexps [Contents][Index]
In case an error occurred while building rex: return an integer representing the associated error code. Return zero if no error occurred.
If an error occurred while building rex: return a pointer to an
ASCIIZ string representing the associated error message. The
returned pointer is valid only while rex is alive: if
cre2_delete()
is applied to rex the pointer becomes invalid.
If rex is a successfully built regular expression object: return a pointer to an empty string.
The following code:
cre2_regexp_t * rex; rex = cre2_new("ci(ao", 5, NULL); { printf("error: code=%d, msg=\"%s\"\n", cre2_error_code(rex), cre2_error_string(rex)); } cre2_delete(rex);
prints:
error: code=6, msg="missing ): ci(ao"
If an error occurred while building rex: fill the structure referenced by arg with the interval of bytes representing the offending portion of the pattern.
If rex is a successfully built regular expression object: arg references an empty string.
The following code:
cre2_regexp_t * rex; cre2_string_t S; rex = cre2_new("ci(ao", 5, NULL); { cre2_error_arg(rex, &S); printf("arg: len=%d, data=\"%s\"\n", S.length, S.data); } cre2_delete(rex);
prints:
arg: len=5 data="ci(ao"
Previous: regexps groups, Up: regexps [Contents][Index]
This document describes version 0.4.0-devel.2 of CRE2.