Документация к библиотекам Wiki
Advertisement

Коды ошибок pcre_exec()[]

If pcre_exec() fails, it returns a negative number. The following are defined in the header file:

Список кодов ошибок
Ошибка Числовое значение Описание
PCRE_ERROR_NOMATCH -1 Совпадений не было найдено
PCRE_ERROR_NULL -2 Был передан нулевой указатель в code или subject, или ovector был нулевым указателем, а ovecsize не был равен 0.
PCRE_ERROR_BADOPTION -3 Неопознанный бит в options.
PCRE_ERROR_BADMAGIC -4 PCRE хранит 4хбайтное "волшебное число" в начале скомпилированного кода,
чтобы отловить the case when it is passed a junk pointer and to detect when a
pattern that was compiled in an environment of one endianness is run in
an environment with the other endianness. Это та ошибка, которую выдаёт PCRE
когда волшебного числа не обнаружено.
PCRE_ERROR_UNKNOWN_OPCODE -5 While running the pattern match, an unknown item was encountered in the
compiled pattern. This error could be caused by a bug in PCRE or by
overwriting of the compiled pattern.
PCRE_ERROR_NOMEMORY -6 If a pattern contains back references, but the ovector that is passed
to pcre_exec() is not big enough to remember the referenced substrings,
PCRE gets a block of memory at the start of matching to use for this
purpose. If the call via pcre_malloc() fails, this error is given. The
memory is automatically freed at the end of matching.This error is also given if pcre_stack_malloc() fails in pcre_exec().
This can happen only when PCRE has been compiled with --disable-stack-
for-recursion.
PCRE_ERROR_NOSUBSTRING -7 This error is used by the pcre_copy_substring(), pcre_get_substring(),
and pcre_get_substring_list() functions (see below). It is never
returned by pcre_exec().
PCRE_ERROR_MATCHLIMIT -8 The backtracking limit, as specified by the match_limit field in a
pcre_extra structure (or defaulted) was reached. See the description
above.
PCRE_ERROR_CALLOUT -9 This error is never generated by pcre_exec() itself. It is provided for
use by callout functions that want to yield a d
PCRE_ERROR_BADUTF8 -10 A string that contains an invalid UTF-8 byte sequence was passed as a
subject. However, if PCRE_PARTIAL_HARD is set and the problem is a
truncated UTF-8 character at the end of the subject, PCRE_ERROR_SHORT-
UTF8 is used instead.
PCRE_ERROR_BADUTF8_OFFSET -11 The UTF-8 byte sequence that was passed as a subject was valid, but the
value of startoffset did not point to the beginning of a UTF-8 charac-
ter or the end of the subject.
PCRE_ERROR_PARTIAL -12 Строка не совпала полностью, но совпала частично Смотри
документацию по частичным совпадениям.
PCRE_ERROR_BADPARTIAL -13 Сейчас не используется. Раньше выдавался когда
вы пытались найти совпадения на основе шаблона, не совместимого с ними. Начиная с версии 8.00
нет ограничений на шаблон для поиска частичных совпадений.
PCRE_ERROR_INTERNAL -14 Произошла неизвестная внутренняя ошибка. Может быть вызванна багом в PCRE или перезаписью скомпилированного шаблона.
PCRE_ERROR_BADCOUNT -15 ovecsize отрицателен
PCRE_ERROR_RECURSIONLIMIT -21 The internal recursion limit, as specified by the match_limit_recursion
field in a pcre_extra structure (or defaulted) was reached. See the
description above.
PCRE_ERROR_BADNEWLINE -23 An invalid combination of PCRE_NEWLINE_xxx options was given.
PCRE_ERROR_BADOFFSET -24 The value of startoffset was negative or greater than the length of the
subject, that is, the value in length.
PCRE_ERROR_SHORTUTF8 -25 The subject string ended with an incomplete (truncated) UTF-8 charac-
ter, and the PCRE_PARTIAL_HARD option was set. Without this option,
PCRE_ERROR_BADUTF8 is returned in this situation.

Error numbers -16 to -20 and -22 are not used by pcre_exec().

Advertisement