Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

regcomp(3) OSS Library Calls Reference Manual
} else
|
printf("String contained a match for the entire re\n");
|
for (count = 0; count <= matches_tocheck; count++) {
|
if (pmatch[count].rm_so != -1) {
|
printf(
|
"Subexpression %i matched in string\n", count);
|
printf(
|
"Match starts at %i. Byte after match is %i\n",
|
pmatch[count].rm_so, pmatch[count].rm_eo);
|
} else
|
printf(
|
"Subexpression %i had NO match\n", count);
|
} |
regfree(&preg);
|
} |
RETURN VALUES
|
Upon successful completion, the regcomp() function returns a value of 0 (zero). Otherwise, it |
returns one the following nonzero values indicating the type of failure. If the regcomp() func- |
tion fails, the contents of the preg parameter is undened. |
If the regexec() function nds a match, it returns a value of 0 (zero). If it does not nd a match |
or fails for another reason, it returns one the following nonzero values indicating the type of |
failure. If the regexec() function does not nd a match or fails for another reason, the contents |
of the pmatch parameter is undened. |
Unless otherwise noted, the following values are returned by the regcomp() function only. |
REG_BADBR ||
The contents within the pair \{ (backslash left brace) and \} (backslash right |
brace) are unusable: Not a number, number too large, more than two numbers, or |
rst number larger than second. |
REG_BADPAT ||
There is an unusable basic regular expression or extended regular expression. |
This value is returned by the regexec() function only. |
REG_BADRPT ||
The ?, *,or+ symbols are not preceded by a valid basic regular expression or an |
extended regular expression. |
REG_EBRACE ||
The use of a pair of \{ (backslash left brace) and \} (backslash right brace) or {} |
(braces) is unbalanced. |
REG_EBRACK ||
The use of [] (square brackets) is unbalanced. |
REG_ECOLLATE ||
There is an unusable collating element referenced. |
REG_ECTYPE ||
There is an unusable character class type referenced. |
596 Hewlett-Packard Company 527187-007