/[pcre]/code/trunk/doc/html/pcreapi.html
ViewVC logotype

Diff of /code/trunk/doc/html/pcreapi.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1193 by ph10, Wed Jun 20 15:15:27 2012 UTC revision 1194 by ph10, Wed Oct 31 17:42:29 2012 UTC
# Line 17  man page, in case the conversion went wr Line 17  man page, in case the conversion went wr
17  <li><a name="TOC2" href="#SEC2">PCRE NATIVE API STRING EXTRACTION FUNCTIONS</a>  <li><a name="TOC2" href="#SEC2">PCRE NATIVE API STRING EXTRACTION FUNCTIONS</a>
18  <li><a name="TOC3" href="#SEC3">PCRE NATIVE API AUXILIARY FUNCTIONS</a>  <li><a name="TOC3" href="#SEC3">PCRE NATIVE API AUXILIARY FUNCTIONS</a>
19  <li><a name="TOC4" href="#SEC4">PCRE NATIVE API INDIRECTED FUNCTIONS</a>  <li><a name="TOC4" href="#SEC4">PCRE NATIVE API INDIRECTED FUNCTIONS</a>
20  <li><a name="TOC5" href="#SEC5">PCRE 8-BIT AND 16-BIT LIBRARIES</a>  <li><a name="TOC5" href="#SEC5">PCRE 8-BIT, 16-BIT AND 32-BIT LIBRARIES</a>
21  <li><a name="TOC6" href="#SEC6">PCRE API OVERVIEW</a>  <li><a name="TOC6" href="#SEC6">PCRE API OVERVIEW</a>
22  <li><a name="TOC7" href="#SEC7">NEWLINES</a>  <li><a name="TOC7" href="#SEC7">NEWLINES</a>
23  <li><a name="TOC8" href="#SEC8">MULTITHREADING</a>  <li><a name="TOC8" href="#SEC8">MULTITHREADING</a>
# Line 116  man page, in case the conversion went wr Line 116  man page, in case the conversion went wr
116  </P>  </P>
117  <br><a name="SEC3" href="#TOC1">PCRE NATIVE API AUXILIARY FUNCTIONS</a><br>  <br><a name="SEC3" href="#TOC1">PCRE NATIVE API AUXILIARY FUNCTIONS</a><br>
118  <P>  <P>
119    <b>int pcre_jit_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
120    <b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
121    <b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
122    <b>pcre_jit_stack *<i>jstack</i>);</b>
123    </P>
124    <P>
125  <b>pcre_jit_stack *pcre_jit_stack_alloc(int <i>startsize</i>, int <i>maxsize</i>);</b>  <b>pcre_jit_stack *pcre_jit_stack_alloc(int <i>startsize</i>, int <i>maxsize</i>);</b>
126  </P>  </P>
127  <P>  <P>
# Line 161  man page, in case the conversion went wr Line 167  man page, in case the conversion went wr
167  <P>  <P>
168  <b>int (*pcre_callout)(pcre_callout_block *);</b>  <b>int (*pcre_callout)(pcre_callout_block *);</b>
169  </P>  </P>
170  <br><a name="SEC5" href="#TOC1">PCRE 8-BIT AND 16-BIT LIBRARIES</a><br>  <br><a name="SEC5" href="#TOC1">PCRE 8-BIT, 16-BIT AND 32-BIT LIBRARIES</a><br>
171  <P>  <P>
172  From release 8.30, PCRE can be compiled as a library for handling 16-bit  From release 8.30, PCRE can be compiled as a library for handling 16-bit
173  character strings as well as, or instead of, the original library that handles  character strings as well as, or instead of, the original library that handles
174  8-bit character strings. To avoid too much complication, this document  8-bit character strings. From release 8.32, PCRE can also be compiled as a
175  describes the 8-bit versions of the functions, with only occasional references  library for handling 32-bit character strings. To avoid too much complication,
176  to the 16-bit library.  this document describes the 8-bit versions of the functions, with only
177    occasional references to the 16-bit and 32-bit libraries.
178  </P>  </P>
179  <P>  <P>
180  The 16-bit functions operate in the same way as their 8-bit counterparts; they  The 16-bit and 32-bit functions operate in the same way as their 8-bit
181  just use different data types for their arguments and results, and their names  counterparts; they just use different data types for their arguments and
182  start with <b>pcre16_</b> instead of <b>pcre_</b>. For every option that has UTF8  results, and their names start with <b>pcre16_</b> or <b>pcre32_</b> instead of
183  in its name (for example, PCRE_UTF8), there is a corresponding 16-bit name with  <b>pcre_</b>. For every option that has UTF8 in its name (for example,
184  UTF8 replaced by UTF16. This facility is in fact just cosmetic; the 16-bit  PCRE_UTF8), there are corresponding 16-bit and 32-bit names with UTF8 replaced
185  option names define the same bit values.  by UTF16 or UTF32, respectively. This facility is in fact just cosmetic; the
186    16-bit and 32-bit option names define the same bit values.
187  </P>  </P>
188  <P>  <P>
189  References to bytes and UTF-8 in this document should be read as references to  References to bytes and UTF-8 in this document should be read as references to
190  16-bit data quantities and UTF-16 when using the 16-bit library, unless  16-bit data quantities and UTF-16 when using the 16-bit library, or 32-bit data
191  specified otherwise. More details of the specific differences for the 16-bit  quantities and UTF-32 when using the 32-bit library, unless specified
192  library are given in the  otherwise. More details of the specific differences for the 16-bit and 32-bit
193    libraries are given in the
194  <a href="pcre16.html"><b>pcre16</b></a>  <a href="pcre16.html"><b>pcre16</b></a>
195  page.  and
196    <a href="pcre32.html"><b>pcre32</b></a>
197    pages.
198  </P>  </P>
199  <br><a name="SEC6" href="#TOC1">PCRE API OVERVIEW</a><br>  <br><a name="SEC6" href="#TOC1">PCRE API OVERVIEW</a><br>
200  <P>  <P>
# Line 233  used if available, by setting an option Line 244  used if available, by setting an option
244  relevant. More complicated programs might need to make use of the functions  relevant. More complicated programs might need to make use of the functions
245  <b>pcre_jit_stack_alloc()</b>, <b>pcre_jit_stack_free()</b>, and  <b>pcre_jit_stack_alloc()</b>, <b>pcre_jit_stack_free()</b>, and
246  <b>pcre_assign_jit_stack()</b> in order to control the JIT code's memory usage.  <b>pcre_assign_jit_stack()</b> in order to control the JIT code's memory usage.
247  These functions are discussed in the  </P>
248    <P>
249    From release 8.32 there is also a direct interface for JIT execution, which
250    gives improved performance. The JIT-specific functions are discussed in the
251  <a href="pcrejit.html"><b>pcrejit</b></a>  <a href="pcrejit.html"><b>pcrejit</b></a>
252  documentation.  documentation.
253  </P>  </P>
# Line 398  not recognized. The following informatio Line 412  not recognized. The following informatio
412    PCRE_CONFIG_UTF8    PCRE_CONFIG_UTF8
413  </pre>  </pre>
414  The output is an integer that is set to one if UTF-8 support is available;  The output is an integer that is set to one if UTF-8 support is available;
415  otherwise it is set to zero. If this option is given to the 16-bit version of  otherwise it is set to zero. This value should normally be given to the 8-bit
416  this function, <b>pcre16_config()</b>, the result is PCRE_ERROR_BADOPTION.  version of this function, <b>pcre_config()</b>. If it is given to the 16-bit
417    or 32-bit version of this function, the result is PCRE_ERROR_BADOPTION.
418  <pre>  <pre>
419    PCRE_CONFIG_UTF16    PCRE_CONFIG_UTF16
420  </pre>  </pre>
421  The output is an integer that is set to one if UTF-16 support is available;  The output is an integer that is set to one if UTF-16 support is available;
422  otherwise it is set to zero. This value should normally be given to the 16-bit  otherwise it is set to zero. This value should normally be given to the 16-bit
423  version of this function, <b>pcre16_config()</b>. If it is given to the 8-bit  version of this function, <b>pcre16_config()</b>. If it is given to the 8-bit
424  version of this function, the result is PCRE_ERROR_BADOPTION.  or 32-bit version of this function, the result is PCRE_ERROR_BADOPTION.
425    <pre>
426      PCRE_CONFIG_UTF32
427    </pre>
428    The output is an integer that is set to one if UTF-32 support is available;
429    otherwise it is set to zero. This value should normally be given to the 32-bit
430    version of this function, <b>pcre32_config()</b>. If it is given to the 8-bit
431    or 16-bit version of this function, the result is PCRE_ERROR_BADOPTION.
432  <pre>  <pre>
433    PCRE_CONFIG_UNICODE_PROPERTIES    PCRE_CONFIG_UNICODE_PROPERTIES
434  </pre>  </pre>
# Line 428  unaligned)". If JIT support is not avail Line 450  unaligned)". If JIT support is not avail
450    PCRE_CONFIG_NEWLINE    PCRE_CONFIG_NEWLINE
451  </pre>  </pre>
452  The output is an integer whose value specifies the default character sequence  The output is an integer whose value specifies the default character sequence
453  that is recognized as meaning "newline". The four values that are supported  that is recognized as meaning "newline". The values that are supported in
454  are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF, and -1 for ANY.  ASCII/Unicode environments are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for
455  Though they are derived from ASCII, the same values are returned in EBCDIC  ANYCRLF, and -1 for ANY. In EBCDIC environments, CR, ANYCRLF, and ANY yield the
456  environments. The default should normally correspond to the standard sequence  same values. However, the value for LF is normally 21, though some EBCDIC
457  for your operating system.  environments use 37. The corresponding values for CRLF are 3349 and 3365. The
458    default should normally correspond to the standard sequence for your operating
459    system.
460  <pre>  <pre>
461    PCRE_CONFIG_BSR    PCRE_CONFIG_BSR
462  </pre>  </pre>
# Line 446  or CRLF. The default can be overridden w Line 470  or CRLF. The default can be overridden w
470  The output is an integer that contains the number of bytes used for internal  The output is an integer that contains the number of bytes used for internal
471  linkage in compiled regular expressions. For the 8-bit library, the value can  linkage in compiled regular expressions. For the 8-bit library, the value can
472  be 2, 3, or 4. For the 16-bit library, the value is either 2 or 4 and is still  be 2, 3, or 4. For the 16-bit library, the value is either 2 or 4 and is still
473  a number of bytes. The default value of 2 is sufficient for all but the most  a number of bytes. For the 32-bit library, the value is either 2 or 4 and is
474  massive patterns, since it allows the compiled pattern to be up to 64K in size.  still a number of bytes. The default value of 2 is sufficient for all but the
475  Larger values allow larger regular expressions to be compiled, at the expense  most massive patterns, since it allows the compiled pattern to be up to 64K in
476  of slower matching.  size. Larger values allow larger regular expressions to be compiled, at the
477    expense of slower matching.
478  <pre>  <pre>
479    PCRE_CONFIG_POSIX_MALLOC_THRESHOLD    PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
480  </pre>  </pre>
# Line 743  indicated by a single character (CR or L Line 768  indicated by a single character (CR or L
768  PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character  PCRE_NEWLINE_CRLF specifies that a newline is indicated by the two-character
769  CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies that any of the three  CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies that any of the three
770  preceding sequences should be recognized. Setting PCRE_NEWLINE_ANY specifies  preceding sequences should be recognized. Setting PCRE_NEWLINE_ANY specifies
771  that any Unicode newline sequence should be recognized. The Unicode newline  that any Unicode newline sequence should be recognized.
772  sequences are the three just mentioned, plus the single characters VT (vertical  </P>
773  tab, U+000B), FF (form feed, U+000C), NEL (next line, U+0085), LS (line  <P>
774  separator, U+2028), and PS (paragraph separator, U+2029). For the 8-bit  In an ASCII/Unicode environment, the Unicode newline sequences are the three
775  library, the last two are recognized only in UTF-8 mode.  just mentioned, plus the single characters VT (vertical tab, U+000B), FF (form
776    feed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
777    (paragraph separator, U+2029). For the 8-bit library, the last two are
778    recognized only in UTF-8 mode.
779    </P>
780    <P>
781    When PCRE is compiled to run in an EBCDIC (mainframe) environment, the code for
782    CR is 0x0d, the same as ASCII. However, the character code for LF is normally
783    0x15, though in some EBCDIC environments 0x25 is used. Whichever of these is
784    not LF is made to correspond to Unicode's NEL character. EBCDIC codes are all
785    less than 256. For more details, see the
786    <a href="pcrebuild.html"><b>pcrebuild</b></a>
787    documentation.
788  </P>  </P>
789  <P>  <P>
790  The newline setting in the options word uses three bits that are treated  The newline setting in the options word uses three bits that are treated
# Line 816  page. Line 853  page.
853  <pre>  <pre>
854    PCRE_NO_UTF8_CHECK    PCRE_NO_UTF8_CHECK
855  </pre>  </pre>
856  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
857  string is automatically checked. There is a discussion about the  automatically checked. There is a discussion about the
858  <a href="pcreunicode.html#utf8strings">validity of UTF-8 strings</a>  <a href="pcreunicode.html#utf8strings">validity of UTF-8 strings</a>
859  in the  in the
860  <a href="pcreunicode.html"><b>pcreunicode</b></a>  <a href="pcreunicode.html"><b>pcreunicode</b></a>
# Line 827  this check for performance reasons, you Line 864  this check for performance reasons, you
864  When it is set, the effect of passing an invalid UTF-8 string as a pattern is  When it is set, the effect of passing an invalid UTF-8 string as a pattern is
865  undefined. It may cause your program to crash. Note that this option can also  undefined. It may cause your program to crash. Note that this option can also
866  be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress the  be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress the
867  validity checking of subject strings.  validity checking of subject strings only. If the same string is being matched
868    many times, the option can be safely set for the second and subsequent
869    matchings to improve performance.
870  </P>  </P>
871  <br><a name="SEC12" href="#TOC1">COMPILATION ERROR CODES</a><br>  <br><a name="SEC12" href="#TOC1">COMPILATION ERROR CODES</a><br>
872  <P>  <P>
873  The following table lists the error codes than may be returned by  The following table lists the error codes than may be returned by
874  <b>pcre_compile2()</b>, along with the error messages that may be returned by  <b>pcre_compile2()</b>, along with the error messages that may be returned by
875  both compiling functions. Note that error messages are always 8-bit ASCII  both compiling functions. Note that error messages are always 8-bit ASCII
876  strings, even in 16-bit mode. As PCRE has developed, some error codes have  strings, even in 16-bit or 32-bit mode. As PCRE has developed, some error codes
877  fallen out of use. To avoid confusion, they have not been re-used.  have fallen out of use. To avoid confusion, they have not been re-used.
878  <pre>  <pre>
879     0  no error     0  no error
880     1  \ at end of pattern     1  \ at end of pattern
# Line 918  fallen out of use. To avoid confusion, t Line 957  fallen out of use. To avoid confusion, t
957    74  invalid UTF-16 string (specifically UTF-16)    74  invalid UTF-16 string (specifically UTF-16)
958    75  name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)    75  name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
959    76  character value in \u.... sequence is too large    76  character value in \u.... sequence is too large
960      77  invalid UTF-32 string (specifically UTF-32)
961  </pre>  </pre>
962  The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may  The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
963  be used if the limits were changed when PCRE was built.  be used if the limits were changed when PCRE was built.
# Line 946  in the section on matching a pattern. Line 986  in the section on matching a pattern.
986  </P>  </P>
987  <P>  <P>
988  If studying the pattern does not produce any useful information,  If studying the pattern does not produce any useful information,
989  <b>pcre_study()</b> returns NULL. In that circumstance, if the calling program  <b>pcre_study()</b> returns NULL by default. In that circumstance, if the
990  wants to pass any of the other fields to <b>pcre_exec()</b> or  calling program wants to pass any of the other fields to <b>pcre_exec()</b> or
991  <b>pcre_dfa_exec()</b>, it must set up its own <b>pcre_extra</b> block.  <b>pcre_dfa_exec()</b>, it must set up its own <b>pcre_extra</b> block. However,
992    if <b>pcre_study()</b> is called with the PCRE_STUDY_EXTRA_NEEDED option, it
993    returns a <b>pcre_extra</b> block even if studying did not find any additional
994    information. It may still return NULL, however, if an error occurs in
995    <b>pcre_study()</b>.
996  </P>  </P>
997  <P>  <P>
998  The second argument of <b>pcre_study()</b> contains option bits. There are three  The second argument of <b>pcre_study()</b> contains option bits. There are three
999  options:  further options in addition to PCRE_STUDY_EXTRA_NEEDED:
1000  <pre>  <pre>
1001    PCRE_STUDY_JIT_COMPILE    PCRE_STUDY_JIT_COMPILE
1002    PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE    PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
# Line 961  options: Line 1005  options:
1005  If any of these are set, and the just-in-time compiler is available, the  If any of these are set, and the just-in-time compiler is available, the
1006  pattern is further compiled into machine code that executes much faster than  pattern is further compiled into machine code that executes much faster than
1007  the <b>pcre_exec()</b> interpretive matching function. If the just-in-time  the <b>pcre_exec()</b> interpretive matching function. If the just-in-time
1008  compiler is not available, these options are ignored. All other bits in the  compiler is not available, these options are ignored. All undefined bits in the
1009  <i>options</i> argument must be zero.  <i>options</i> argument must be zero.
1010  </P>  </P>
1011  <P>  <P>
# Line 1011  real application there should be tests f Line 1055  real application there should be tests f
1055  Studying a pattern does two things: first, a lower bound for the length of  Studying a pattern does two things: first, a lower bound for the length of
1056  subject string that is needed to match the pattern is computed. This does not  subject string that is needed to match the pattern is computed. This does not
1057  mean that there are any strings of that length that match, but it does  mean that there are any strings of that length that match, but it does
1058  guarantee that no shorter strings match. The value is used by  guarantee that no shorter strings match. The value is used to avoid wasting
1059  <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b> to avoid wasting time by trying to  time by trying to match strings that are shorter than the lower bound. You can
1060  match strings that are shorter than the lower bound. You can find out the value  find out the value in a calling program via the <b>pcre_fullinfo()</b> function.
 in a calling program via the <b>pcre_fullinfo()</b> function.  
1061  </P>  </P>
1062  <P>  <P>
1063  Studying a pattern is also useful for non-anchored patterns that do not have a  Studying a pattern is also useful for non-anchored patterns that do not have a
1064  single fixed starting character. A bitmap of possible starting bytes is  single fixed starting character. A bitmap of possible starting bytes is
1065  created. This speeds up finding a position in the subject at which to start  created. This speeds up finding a position in the subject at which to start
1066  matching. (In 16-bit mode, the bitmap is used for 16-bit values less than 256.)  matching. (In 16-bit mode, the bitmap is used for 16-bit values less than 256.
1067    In 32-bit mode, the bitmap is used for 32-bit values less than 256.)
1068  </P>  </P>
1069  <P>  <P>
1070  These two optimizations apply to both <b>pcre_exec()</b> and  These two optimizations apply to both <b>pcre_exec()</b> and
# Line 1165  variable. Line 1209  variable.
1209  <P>  <P>
1210  If there is a fixed first value, for example, the letter "c" from a pattern  If there is a fixed first value, for example, the letter "c" from a pattern
1211  such as (cat|cow|coyote), its value is returned. In the 8-bit library, the  such as (cat|cow|coyote), its value is returned. In the 8-bit library, the
1212  value is always less than 256; in the 16-bit library the value can be up to  value is always less than 256. In the 16-bit library the value can be up to
1213  0xffff.  0xffff. In the 32-bit library the value can be up to 0x10ffff.
1214  </P>  </P>
1215  <P>  <P>
1216  If there is no fixed first value, and if either  If there is no fixed first value, and if either
# Line 1183  starts with "^", or Line 1227  starts with "^", or
1227  -1 is returned, indicating that the pattern matches only at the start of a  -1 is returned, indicating that the pattern matches only at the start of a
1228  subject string or after any newline within the string. Otherwise -2 is  subject string or after any newline within the string. Otherwise -2 is
1229  returned. For anchored patterns, -2 is returned.  returned. For anchored patterns, -2 is returned.
1230    </P>
1231    <P>
1232    Since for the 32-bit library using the non-UTF-32 mode, this function is unable
1233    to return the full 32-bit range of the character, this value is deprecated;
1234    instead the PCRE_INFO_FIRSTCHARACTERFLAGS and PCRE_INFO_FIRSTCHARACTER values
1235    should be used.
1236  <pre>  <pre>
1237    PCRE_INFO_FIRSTTABLE    PCRE_INFO_FIRSTTABLE
1238  </pre>  </pre>
# Line 1228  value, -1 is returned. For anchored patt Line 1278  value, -1 is returned. For anchored patt
1278  only if it follows something of variable length. For example, for the pattern  only if it follows something of variable length. For example, for the pattern
1279  /^a\d+z\d+/ the returned value is "z", but for /^a\dz\d/ the returned value  /^a\d+z\d+/ the returned value is "z", but for /^a\dz\d/ the returned value
1280  is -1.  is -1.
1281    </P>
1282    <P>
1283    Since for the 32-bit library using the non-UTF-32 mode, this function is unable
1284    to return the full 32-bit range of the character, this value is deprecated;
1285    instead the PCRE_INFO_REQUIREDCHARFLAGS and PCRE_INFO_REQUIREDCHAR values should
1286    be used.
1287  <pre>  <pre>
1288    PCRE_INFO_MAXLOOKBEHIND    PCRE_INFO_MAXLOOKBEHIND
1289  </pre>  </pre>
# Line 1268  length of the longest name. PCRE_INFO_NA Line 1324  length of the longest name. PCRE_INFO_NA
1324  entry of the table. This is a pointer to <b>char</b> in the 8-bit library, where  entry of the table. This is a pointer to <b>char</b> in the 8-bit library, where
1325  the first two bytes of each entry are the number of the capturing parenthesis,  the first two bytes of each entry are the number of the capturing parenthesis,
1326  most significant byte first. In the 16-bit library, the pointer points to  most significant byte first. In the 16-bit library, the pointer points to
1327  16-bit data units, the first of which contains the parenthesis number. The rest  16-bit data units, the first of which contains the parenthesis number.
1328    In the 32-bit library, the pointer points to 32-bit data units, the first of
1329    which contains the parenthesis number. The rest
1330  of the entry is the corresponding name, zero terminated.  of the entry is the corresponding name, zero terminated.
1331  </P>  </P>
1332  <P>  <P>
# Line 1357  above). The format of the <i>study_data< Line 1415  above). The format of the <i>study_data<
1415  is made available via this option so that it can be saved and restored (see the  is made available via this option so that it can be saved and restored (see the
1416  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>
1417  documentation for details).  documentation for details).
1418    <pre>
1419      PCRE_INFO_FIRSTCHARACTERFLAGS
1420    </pre>
1421    Return information about the first data unit of any matched string, for a
1422    non-anchored pattern. The fourth argument should point to an <b>int</b>
1423    variable.
1424    </P>
1425    <P>
1426    If there is a fixed first value, for example, the letter "c" from a pattern
1427    such as (cat|cow|coyote), 1 is returned, and the character value can be
1428    retrieved using PCRE_INFO_FIRSTCHARACTER.
1429    </P>
1430    <P>
1431    If there is no fixed first value, and if either
1432    <br>
1433    <br>
1434    (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
1435    starts with "^", or
1436    <br>
1437    <br>
1438    (b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
1439    (if it were set, the pattern would be anchored),
1440    <br>
1441    <br>
1442    2 is returned, indicating that the pattern matches only at the start of a
1443    subject string or after any newline within the string. Otherwise 0 is
1444    returned. For anchored patterns, 0 is returned.
1445    <pre>
1446      PCRE_INFO_FIRSTCHARACTER
1447    </pre>
1448    Return the fixed first character value, if PCRE_INFO_FIRSTCHARACTERFLAGS
1449    returned 1; otherwise returns 0. The fourth argument should point to an
1450    <b>uint_t</b> variable.
1451    </P>
1452    <P>
1453    In the 8-bit library, the value is always less than 256. In the 16-bit library
1454    the value can be up to 0xffff. In the 32-bit library in UTF-32 mode the value
1455    can be up to 0x10ffff, and up to 0xffffffff when not using UTF-32 mode.
1456    </P>
1457    <P>
1458    If there is no fixed first value, and if either
1459    <br>
1460    <br>
1461    (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
1462    starts with "^", or
1463    <br>
1464    <br>
1465    (b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
1466    (if it were set, the pattern would be anchored),
1467    <br>
1468    <br>
1469    -1 is returned, indicating that the pattern matches only at the start of a
1470    subject string or after any newline within the string. Otherwise -2 is
1471    returned. For anchored patterns, -2 is returned.
1472    <pre>
1473      PCRE_INFO_REQUIREDCHARFLAGS
1474    </pre>
1475    Returns 1 if there is a rightmost literal data unit that must exist in any
1476    matched string, other than at its start. The fourth argument should  point to
1477    an <b>int</b> variable. If there is no such value, 0 is returned. If returning
1478    1, the character value itself can be retrieved using PCRE_INFO_REQUIREDCHAR.
1479    </P>
1480    <P>
1481    For anchored patterns, a last literal value is recorded only if it follows
1482    something of variable length. For example, for the pattern /^a\d+z\d+/ the
1483    returned value 1 (with "z" returned from PCRE_INFO_REQUIREDCHAR), but for
1484    /^a\dz\d/ the returned value is 0.
1485    <pre>
1486      PCRE_INFO_REQUIREDCHAR
1487    </pre>
1488    Return the value of the rightmost literal data unit that must exist in any
1489    matched string, other than at its start, if such a value has been recorded. The
1490    fourth argument should point to an <b>uint32_t</b> variable. If there is no such
1491    value, 0 is returned.
1492  </P>  </P>
1493  <br><a name="SEC16" href="#TOC1">REFERENCE COUNTS</a><br>  <br><a name="SEC16" href="#TOC1">REFERENCE COUNTS</a><br>
1494  <P>  <P>
# Line 1449  fields (not necessarily in this order): Line 1581  fields (not necessarily in this order):
1581  </pre>  </pre>
1582  In the 16-bit version of this structure, the <i>mark</i> field has type  In the 16-bit version of this structure, the <i>mark</i> field has type
1583  "PCRE_UCHAR16 **".  "PCRE_UCHAR16 **".
1584    <br>
1585    <br>
1586    In the 32-bit version of this structure, the <i>mark</i> field has type
1587    "PCRE_UCHAR32 **".
1588  </P>  </P>
1589  <P>  <P>
1590  The <i>flags</i> field is used to specify which of the other fields are set. The  The <i>flags</i> field is used to specify which of the other fields are set. The
# Line 2089  documentation for more details. Line 2225  documentation for more details.
2225    PCRE_ERROR_BADMODE        (-28)    PCRE_ERROR_BADMODE        (-28)
2226  </pre>  </pre>
2227  This error is given if a pattern that was compiled by the 8-bit library is  This error is given if a pattern that was compiled by the 8-bit library is
2228  passed to a 16-bit library function, or vice versa.  passed to a 16-bit or 32-bit library function, or vice versa.
2229  <pre>  <pre>
2230    PCRE_ERROR_BADENDIANNESS  (-29)    PCRE_ERROR_BADENDIANNESS  (-29)
2231  </pre>  </pre>
# Line 2097  This error is given if a pattern that wa Line 2233  This error is given if a pattern that wa
2233  host with different endianness. The utility function  host with different endianness. The utility function
2234  <b>pcre_pattern_to_host_byte_order()</b> can be used to convert such a pattern  <b>pcre_pattern_to_host_byte_order()</b> can be used to convert such a pattern
2235  so that it runs on the new host.  so that it runs on the new host.
2236    <pre>
2237      PCRE_ERROR_JIT_BADOPTION
2238    </pre>
2239    This error is returned when a pattern that was successfully studied using a JIT
2240    compile option is being matched, but the matching mode (partial or complete
2241    match) does not correspond to any JIT compilation mode. When the JIT fast path
2242    function is used, this error may be also given for invalid options. See the
2243    <a href="pcrejit.html"><b>pcrejit</b></a>
2244    documentation for more details.
2245    <pre>
2246      PCRE_ERROR_BADLENGTH      (-32)
2247    </pre>
2248    This error is given if <b>pcre_exec()</b> is called with a negative value for
2249    the <i>length</i> argument.
2250  </P>  </P>
2251  <P>  <P>
2252  Error numbers -16 to -20, -22, and -30 are not used by <b>pcre_exec()</b>.  Error numbers -16 to -20, -22, and 30 are not used by <b>pcre_exec()</b>.
2253  <a name="badutf8reasons"></a></P>  <a name="badutf8reasons"></a></P>
2254  <br><b>  <br><b>
2255  Reason codes for invalid UTF-8 strings  Reason codes for invalid UTF-8 strings
# Line 2108  Reason codes for invalid UTF-8 strings Line 2258  Reason codes for invalid UTF-8 strings
2258  This section applies only to the 8-bit library. The corresponding information  This section applies only to the 8-bit library. The corresponding information
2259  for the 16-bit library is given in the  for the 16-bit library is given in the
2260  <a href="pcre16.html"><b>pcre16</b></a>  <a href="pcre16.html"><b>pcre16</b></a>
2261    page. The corresponding information for the 32-bit library is given in the
2262    <a href="pcre32.html"><b>pcre32</b></a>
2263  page.  page.
2264  </P>  </P>
2265  <P>  <P>
# Line 2179  character. Line 2331  character.
2331  </pre>  </pre>
2332  The first byte of a character has the value 0xfe or 0xff. These values can  The first byte of a character has the value 0xfe or 0xff. These values can
2333  never occur in a valid UTF-8 string.  never occur in a valid UTF-8 string.
2334    <pre>
2335      PCRE_UTF8_ERR2
2336    </pre>
2337    Non-character. These are the last two characters in each plane (0xfffe, 0xffff,
2338    0x1fffe, 0x1ffff .. 0x10fffe, 0x10ffff), and the characters 0xfdd0..0xfdef.
2339  </P>  </P>
2340  <br><a name="SEC18" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>  <br><a name="SEC18" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
2341  <P>  <P>
# Line 2604  fail, this error is given. Line 2761  fail, this error is given.
2761  </P>  </P>
2762  <br><a name="SEC24" href="#TOC1">SEE ALSO</a><br>  <br><a name="SEC24" href="#TOC1">SEE ALSO</a><br>
2763  <P>  <P>
2764  <b>pcre16</b>(3), <b>pcrebuild</b>(3), <b>pcrecallout</b>(3), <b>pcrecpp(3)</b>(3),  <b>pcre16</b>(3), <b>pcre32</b>(3), <b>pcrebuild</b>(3), <b>pcrecallout</b>(3),
2765  <b>pcrematching</b>(3), <b>pcrepartial</b>(3), <b>pcreposix</b>(3),  <b>pcrecpp(3)</b>(3), <b>pcrematching</b>(3), <b>pcrepartial</b>(3),
2766  <b>pcreprecompile</b>(3), <b>pcresample</b>(3), <b>pcrestack</b>(3).  <b>pcreposix</b>(3), <b>pcreprecompile</b>(3), <b>pcresample</b>(3),
2767    <b>pcrestack</b>(3).
2768  </P>  </P>
2769  <br><a name="SEC25" href="#TOC1">AUTHOR</a><br>  <br><a name="SEC25" href="#TOC1">AUTHOR</a><br>
2770  <P>  <P>
# Line 2619  Cambridge CB2 3QH, England. Line 2777  Cambridge CB2 3QH, England.
2777  </P>  </P>
2778  <br><a name="SEC26" href="#TOC1">REVISION</a><br>  <br><a name="SEC26" href="#TOC1">REVISION</a><br>
2779  <P>  <P>
2780  Last updated: 17 June 2012  Last updated: 31 October 2012
2781  <br>  <br>
2782  Copyright &copy; 1997-2012 University of Cambridge.  Copyright &copy; 1997-2012 University of Cambridge.
2783  <br>  <br>

Legend:
Removed from v.1193  
changed lines
  Added in v.1194

  ViewVC Help
Powered by ViewVC 1.1.5