| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Regexp
Regexp.PCRE
Regexp.PCRE._pcre

# Method Regexp.PCRE._pcre()->exec()

Method exec

  `int|array exec(string subject, void|int startoffset)`

Description

  match a regexp; will return an array of 2*n integers where n is the number of hits; returns an int upon failure

  Error codes:

  `ERROR.NOMATCH` | The subject string did not match the pattern.
  `ERROR.NULL` | Either code or subject was passed as NULL, or ovector was NULL and oversize was not zero.
  `ERROR.BADOPTION` | An unrecognized bit was set in the options argument.
  `ERROR.BADMAGIC` | PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch the case when it is passed a junk pointer. This is the error it gives when the magic number isn't present.
  `ERROR.UNKNOWN_NODE` | 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.
  `ERROR.NOMEMORY` | 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 freed at the end of matching.
  `ERROR.NOSUBSTRING` | 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().
  `ERROR.MATCHLIMIT` | The recursion and backtracking limit, as specified by the match_limit field in a pcre_extra structure (or defaulted) was reached. See the description above.
  `ERROR.CALLOUT` | This error is never generated by pcre_exec() itself. It is provided for use by callout functions that want to yield a distinctive error code. See the pcrecallout documentation for details.