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

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

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

Method info

  `mapping info()`

Description

  Returns additional information about a compiled pattern. Only available if PCRE was compiled with Fullinfo.

Returns

  `"backrefmax" : int` | Return the number of the highest back reference in the pattern. The fourth argument should point to an int variable. Zero is returned if there are no back references.
  `"capturecount" : int` | Return the number of capturing subpatterns in the pattern. The fourth argument should point to an int variable.

  `"firstbyte" : int`

  Return information about the first byte of any matched string, for a non-anchored pattern. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name is still recognized for backwards compatibility.)

  If there is a fixed first byte, e.g. from a pattern such as (cat|cow|coyote), it is returned in the integer pointed to by where. Otherwise, if either

  (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch starts with `"^"`, or

  (b) every branch of the pattern starts with `".*"` and PCRE_DOTALL is not set (if it were set, the pattern would be anchored),

  `-1` is returned, indicating that the pattern matches only at the start of a subject string or after any newline within the string. Otherwise `-2` is returned. For anchored patterns, `-2` is returned.

  `"lastliteral" : int`

  Return the value of the rightmost literal byte that must exist in any matched string, other than at its start, if such a byte has been recorded. The fourth argument should point to an int variable. If there is no such byte, `-1` is returned. For anchored patterns, a last literal byte is recorded only if it follows something of variable length. For example, for the pattern /^a\d+z\d+/ the returned value is `"z"`, but for /^a\dz\d/ the returned value is `-1`.

  `"namecount" : int` |
  `"nameentrysize" : int` |

  `"options" : int`

  Return a copy of the options with which the pattern was compiled. The fourth argument should point to an unsigned long int variable. These option bits are those specified in the call to pcre_compile(), modified by any top-level option settings within the pattern itself.

  A pattern is automatically anchored by PCRE if all of its top-level alternatives begin with one of the following:

  ^ | unless PCRE_MULTILINE is set
  \A | always
  \G | always
  .* | if PCRE_DOTALL is set and there are no back references to the subpattern in which .* appears

  For such patterns, the PCRE_ANCHORED bit is set in the options returned.

  `"size" : int` | Return the size of the compiled pattern, that is, the value that was passed as the argument to pcre_malloc() when PCRE was getting memory in which to place the compiled data. The fourth argument should point to a size_t variable.
  `"studysize" : int` | Returns the size of the data block pointed to by the study_data field in a pcre_extra block. That is, it is the value that was passed to pcre_malloc() when PCRE was getting memory into which to place the data created by pcre_study(). The fourth argument should point to a size_t variable.