ExecExec — applies a regular expression match to a subject string.
Regex.Exec(extra, subject, length, startoffset, options, substrings)
extraAn instance of pcre_extra returned from
Regex.Study, or nil.
subjectThe subject string on which to apply the pattern. This may be
either a string or a buffer. If the subject is a buffer it may
contain NUL characters.
lengthThe length of the subject, in bytes. If length is
-1, the length of the subject string is
computed automatically .
startoffsetA byte offset into the subject specifying at which point to start.
optionsOption flags - a bitwise OR of zero or more of these flags:
PCRE_ANCHORED |
PCRE_NEWLINE_CR |
PCRE_NEWLINE_LF |
PCRE_NEWLINE_CRLF |
PCRE_NEWLINE_ANYCRLF |
PCRE_NEWLINE_ANY |
PCRE_NOTBOL |
PCRE_NOTEOL |
PCRE_NOTEMPTY |
PCRE_NOTEMPTY_ATSTART |
PCRE_NO_START_OPTIMIZE |
PCRE_NO_UTF8_CHECK |
PCRE_PARTIAL_SOFT |
PCRE_PARTIAL_HARD |
substringsAn array into which the match substrings are copied. The
substrings array cannot be nil. The match substrings will be
written into the substrings array starting at position
0. If the array is not large enough to hold
all of the substrings it will be automatically expanded.
Each element of the substrings array is itself an array of 3 elements:
[0] - the zero-based starting
character of the match |
[1] - the character position
immediately after the match |
[2] - the string that
matched. |
This will be returned as a buffer if the subject is a buffer, otherwise it will be a string.
The first element in the substrings array always contains the complete matching string within the subject. Each element after the first corresponds to a positional substring specified within the pattern.
On success, an array of match specifications as described in the
substrings parameter (above). On failure, an error
list with three elements: