| 435 |
Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fP returns |
Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fP returns |
| 436 |
NULL, and sets the variable pointed to by \fIerrptr\fP to point to a textual |
NULL, and sets the variable pointed to by \fIerrptr\fP to point to a textual |
| 437 |
error message. This is a static string that is part of the library. You must |
error message. This is a static string that is part of the library. You must |
| 438 |
not try to free it. The byte offset from the start of the pattern to the |
not try to free it. The offset from the start of the pattern to the byte that |
| 439 |
character that was being processed when the error was discovered is placed in |
was being processed when the error was discovered is placed in the variable |
| 440 |
the variable pointed to by \fIerroffset\fP, which must not be NULL. If it is, |
pointed to by \fIerroffset\fP, which must not be NULL. If it is, an immediate |
| 441 |
an immediate error is given. Some errors are not detected until checks are |
error is given. Some errors are not detected until checks are carried out when |
| 442 |
carried out when the whole pattern has been scanned; in this case the offset is |
the whole pattern has been scanned; in this case the offset is set to the end |
| 443 |
set to the end of the pattern. |
of the pattern. |
| 444 |
|
.P |
| 445 |
|
Note that the offset is in bytes, not characters, even in UTF-8 mode. It may |
| 446 |
|
point into the middle of a UTF-8 character (for example, when |
| 447 |
|
PCRE_ERROR_BADUTF8 is returned for an invalid UTF-8 string). |
| 448 |
.P |
.P |
| 449 |
If \fBpcre_compile2()\fP is used instead of \fBpcre_compile()\fP, and the |
If \fBpcre_compile2()\fP is used instead of \fBpcre_compile()\fP, and the |
| 450 |
\fIerrorcodeptr\fP argument is not NULL, a non-zero error code number is |
\fIerrorcodeptr\fP argument is not NULL, a non-zero error code number is |
| 1519 |
\fBpcre\fP |
\fBpcre\fP |
| 1520 |
.\" |
.\" |
| 1521 |
page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_exec()\fP returns |
page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_exec()\fP returns |
| 1522 |
the error PCRE_ERROR_BADUTF8. If \fIstartoffset\fP contains a value that does |
the error PCRE_ERROR_BADUTF8 or, if PCRE_PARTIAL_HARD is set and the problem is |
| 1523 |
not point to the start of a UTF-8 character (or to the end of the subject), |
a truncated UTF-8 character at the end of the subject, PCRE_ERROR_SHORTUTF8. If |
| 1524 |
PCRE_ERROR_BADUTF8_OFFSET is returned. |
\fIstartoffset\fP contains a value that does not point to the start of a UTF-8 |
| 1525 |
|
character (or to the end of the subject), PCRE_ERROR_BADUTF8_OFFSET is |
| 1526 |
|
returned. |
| 1527 |
.P |
.P |
| 1528 |
If you already know that your subject is valid, and you want to skip these |
If you already know that your subject is valid, and you want to skip these |
| 1529 |
checks for performance reasons, you can set the PCRE_NO_UTF8_CHECK option when |
checks for performance reasons, you can set the PCRE_NO_UTF8_CHECK option when |
| 1762 |
PCRE_ERROR_BADUTF8 (-10) |
PCRE_ERROR_BADUTF8 (-10) |
| 1763 |
.sp |
.sp |
| 1764 |
A string that contains an invalid UTF-8 byte sequence was passed as a subject. |
A string that contains an invalid UTF-8 byte sequence was passed as a subject. |
| 1765 |
|
However, if PCRE_PARTIAL_HARD is set and the problem is a truncated UTF-8 |
| 1766 |
|
character at the end of the subject, PCRE_ERROR_SHORTUTF8 is used instead. |
| 1767 |
.sp |
.sp |
| 1768 |
PCRE_ERROR_BADUTF8_OFFSET (-11) |
PCRE_ERROR_BADUTF8_OFFSET (-11) |
| 1769 |
.sp |
.sp |
| 1770 |
The UTF-8 byte sequence that was passed as a subject was valid, but the value |
The UTF-8 byte sequence that was passed as a subject was valid, but the value |
| 1771 |
of \fIstartoffset\fP did not point to the beginning of a UTF-8 character. |
of \fIstartoffset\fP did not point to the beginning of a UTF-8 character or the |
| 1772 |
|
end of the subject. |
| 1773 |
.sp |
.sp |
| 1774 |
PCRE_ERROR_PARTIAL (-12) |
PCRE_ERROR_PARTIAL (-12) |
| 1775 |
.sp |
.sp |
| 1809 |
.sp |
.sp |
| 1810 |
The value of \fIstartoffset\fP was negative or greater than the length of the |
The value of \fIstartoffset\fP was negative or greater than the length of the |
| 1811 |
subject, that is, the value in \fIlength\fP. |
subject, that is, the value in \fIlength\fP. |
| 1812 |
|
.sp |
| 1813 |
|
PCRE_ERROR_SHORTUTF8 (-25) |
| 1814 |
|
.sp |
| 1815 |
|
The subject string ended with an incomplete (truncated) UTF-8 character, and |
| 1816 |
|
the PCRE_PARTIAL_HARD option was set. Without this option, PCRE_ERROR_BADUTF8 |
| 1817 |
|
is returned in this situation. |
| 1818 |
.P |
.P |
| 1819 |
Error numbers -16 to -20 and -22 are not used by \fBpcre_exec()\fP. |
Error numbers -16 to -20 and -22 are not used by \fBpcre_exec()\fP. |
| 1820 |
. |
. |