Elliott Hughes | 0c26e19 | 2019-08-07 12:24:46 -0700 | [diff] [blame] | 1 | .TH PCRE2_PATTERN_INFO 3 "14 February 2019" "PCRE2 10.33" |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 2 | .SH NAME |
| 3 | PCRE2 - Perl-compatible regular expressions (revised API) |
| 4 | .SH SYNOPSIS |
| 5 | .rs |
| 6 | .sp |
| 7 | .B #include <pcre2.h> |
| 8 | .PP |
| 9 | .nf |
Elliott Hughes | 0c26e19 | 2019-08-07 12:24:46 -0700 | [diff] [blame] | 10 | .B int pcre2_pattern_info(const pcre2_code *\fIcode\fP, uint32_t \fIwhat\fP, |
| 11 | .B " void *\fIwhere\fP);" |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 12 | .fi |
| 13 | . |
| 14 | .SH DESCRIPTION |
| 15 | .rs |
| 16 | .sp |
| 17 | This function returns information about a compiled pattern. Its arguments are: |
| 18 | .sp |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 19 | \fIcode\fP Pointer to a compiled regular expression pattern |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 20 | \fIwhat\fP What information is required |
| 21 | \fIwhere\fP Where to put the information |
| 22 | .sp |
| 23 | The recognized values for the \fIwhat\fP argument, and the information they |
| 24 | request are as follows: |
| 25 | .sp |
| 26 | PCRE2_INFO_ALLOPTIONS Final options after compiling |
| 27 | PCRE2_INFO_ARGOPTIONS Options passed to \fBpcre2_compile()\fP |
Elliott Hughes | 653c210 | 2019-01-09 15:41:36 -0800 | [diff] [blame] | 28 | PCRE2_INFO_BACKREFMAX Number of highest backreference |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 29 | PCRE2_INFO_BSR What \eR matches: |
| 30 | PCRE2_BSR_UNICODE: Unicode line endings |
| 31 | PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only |
| 32 | PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 33 | .\" JOIN |
| 34 | PCRE2_INFO_DEPTHLIMIT Backtracking depth limit if set, |
| 35 | otherwise PCRE2_ERROR_UNSET |
| 36 | PCRE2_INFO_EXTRAOPTIONS Extra options that were passed in the |
| 37 | compile context |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 38 | PCRE2_INFO_FIRSTBITMAP Bitmap of first code units, or NULL |
| 39 | PCRE2_INFO_FIRSTCODETYPE Type of start-of-match information |
| 40 | 0 nothing set |
| 41 | 1 first code unit is set |
| 42 | 2 start of string or after newline |
| 43 | PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1 |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 44 | PCRE2_INFO_FRAMESIZE Size of backtracking frame |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 45 | PCRE2_INFO_HASBACKSLASHC Return 1 if pattern contains \eC |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 46 | .\" JOIN |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 47 | PCRE2_INFO_HASCRORLF Return 1 if explicit CR or LF matches |
| 48 | exist in the pattern |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 49 | .\" JOIN |
| 50 | PCRE2_INFO_HEAPLIMIT Heap memory limit if set, |
| 51 | otherwise PCRE2_ERROR_UNSET |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 52 | PCRE2_INFO_JCHANGED Return 1 if (?J) or (?-J) was used |
| 53 | PCRE2_INFO_JITSIZE Size of JIT compiled code, or 0 |
| 54 | PCRE2_INFO_LASTCODETYPE Type of must-be-present information |
| 55 | 0 nothing set |
| 56 | 1 code unit is set |
| 57 | PCRE2_INFO_LASTCODEUNIT Last code unit when type is 1 |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 58 | .\" JOIN |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 59 | PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an |
| 60 | empty string, 0 otherwise |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 61 | .\" JOIN |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 62 | PCRE2_INFO_MATCHLIMIT Match limit if set, |
| 63 | otherwise PCRE2_ERROR_UNSET |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 64 | .\" JOIN |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 65 | PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest |
| 66 | lookbehind assertion |
| 67 | PCRE2_INFO_MINLENGTH Lower bound length of matching strings |
| 68 | PCRE2_INFO_NAMECOUNT Number of named subpatterns |
| 69 | PCRE2_INFO_NAMEENTRYSIZE Size of name table entries |
| 70 | PCRE2_INFO_NAMETABLE Pointer to name table |
| 71 | PCRE2_CONFIG_NEWLINE Code for the newline sequence: |
| 72 | PCRE2_NEWLINE_CR |
| 73 | PCRE2_NEWLINE_LF |
| 74 | PCRE2_NEWLINE_CRLF |
| 75 | PCRE2_NEWLINE_ANY |
| 76 | PCRE2_NEWLINE_ANYCRLF |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 77 | PCRE2_NEWLINE_NUL |
| 78 | PCRE2_INFO_RECURSIONLIMIT Obsolete synonym for PCRE2_INFO_DEPTHLIMIT |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 79 | PCRE2_INFO_SIZE Size of compiled pattern |
| 80 | .sp |
| 81 | If \fIwhere\fP is NULL, the function returns the amount of memory needed for |
| 82 | the requested information, in bytes. Otherwise, the \fIwhere\fP argument must |
| 83 | point to an unsigned 32-bit integer (uint32_t variable), except for the |
| 84 | following \fIwhat\fP values, when it must point to a variable of the type |
| 85 | shown: |
| 86 | .sp |
| 87 | PCRE2_INFO_FIRSTBITMAP const uint8_t * |
| 88 | PCRE2_INFO_JITSIZE size_t |
| 89 | PCRE2_INFO_NAMETABLE PCRE2_SPTR |
| 90 | PCRE2_INFO_SIZE size_t |
| 91 | .sp |
| 92 | The yield of the function is zero on success or: |
| 93 | .sp |
| 94 | PCRE2_ERROR_NULL the argument \fIcode\fP is NULL |
| 95 | PCRE2_ERROR_BADMAGIC the "magic number" was not found |
| 96 | PCRE2_ERROR_BADOPTION the value of \fIwhat\fP is invalid |
| 97 | PCRE2_ERROR_BADMODE the pattern was compiled in the wrong mode |
| 98 | PCRE2_ERROR_UNSET the requested information is not set |
| 99 | .P |
| 100 | There is a complete description of the PCRE2 native API in the |
| 101 | .\" HREF |
| 102 | \fBpcre2api\fP |
| 103 | .\" |
| 104 | page and a description of the POSIX API in the |
| 105 | .\" HREF |
| 106 | \fBpcre2posix\fP |
| 107 | .\" |
| 108 | page. |