/[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 99 by ph10, Tue Mar 6 12:27:42 2007 UTC revision 227 by ph10, Tue Aug 21 15:00:15 2007 UTC
# Line 7  Line 7 
7  <p>  <p>
8  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.
9  </p>  </p>
10  <p>  <p>
11  This page is part of the PCRE HTML documentation. It was generated automatically  This page is part of the PCRE HTML documentation. It was generated automatically
12  from the original man page. If there is any nonsense in it, please consult the  from the original man page. If there is any nonsense in it, please consult the
13  man page, in case the conversion went wrong.  man page, in case the conversion went wrong.
14  <br>  <br>
15  <ul>  <ul>
16  <li><a name="TOC1" href="#SEC1">PCRE NATIVE API</a>  <li><a name="TOC1" href="#SEC1">PCRE NATIVE API</a>
17  <li><a name="TOC2" href="#SEC2">PCRE API OVERVIEW</a>  <li><a name="TOC2" href="#SEC2">PCRE API OVERVIEW</a>
# Line 243  by the caller to a "callout" function, w Line 243  by the caller to a "callout" function, w
243  points during a matching operation. Details are given in the  points during a matching operation. Details are given in the
244  <a href="pcrecallout.html"><b>pcrecallout</b></a>  <a href="pcrecallout.html"><b>pcrecallout</b></a>
245  documentation.  documentation.
246  </P>  <a name="newlines"></a></P>
247  <br><a name="SEC3" href="#TOC1">NEWLINES</a><br>  <br><a name="SEC3" href="#TOC1">NEWLINES</a><br>
248  <P>  <P>
249  PCRE supports four different conventions for indicating line breaks in  PCRE supports five different conventions for indicating line breaks in
250  strings: a single CR (carriage return) character, a single LF (linefeed)  strings: a single CR (carriage return) character, a single LF (linefeed)
251  character, the two-character sequence CRLF, or any Unicode newline sequence.  character, the two-character sequence CRLF, any of the three preceding, or any
252  The Unicode newline sequences are the three just mentioned, plus the single  Unicode newline sequence. The Unicode newline sequences are the three just
253  characters VT (vertical tab, U+000B), FF (formfeed, U+000C), NEL (next line,  mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,
254  U+0085), LS (line separator, U+2028), and PS (paragraph separator, U+2029).  U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
255    (paragraph separator, U+2029).
256  </P>  </P>
257  <P>  <P>
258  Each of the first three conventions is used by at least one operating system as  Each of the first three conventions is used by at least one operating system as
# Line 261  default can be overridden, either when a Line 262  default can be overridden, either when a
262  matched.  matched.
263  </P>  </P>
264  <P>  <P>
265    At compile time, the newline convention can be specified by the <i>options</i>
266    argument of <b>pcre_compile()</b>, or it can be specified by special text at the
267    start of the pattern itself; this overrides any other settings. See the
268    <a href="pcrepattern.html"><b>pcrepattern</b></a>
269    page for details of the special character sequences.
270    </P>
271    <P>
272  In the PCRE documentation the word "newline" is used to mean "the character or  In the PCRE documentation the word "newline" is used to mean "the character or
273  pair of characters that indicate a line break". The choice of newline  pair of characters that indicate a line break". The choice of newline
274  convention affects the handling of the dot, circumflex, and dollar  convention affects the handling of the dot, circumflex, and dollar
275  metacharacters, the handling of #-comments in /x mode, and, when CRLF is a  metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
276  recognized line ending sequence, the match position advancement for a  recognized line ending sequence, the match position advancement for a
277  non-anchored pattern. The choice of newline convention does not affect the  non-anchored pattern. There is more detail about this in the
278  interpretation of the \n or \r escape sequences.  <a href="#execoptions">section on <b>pcre_exec()</b> options</a>
279    below. The choice of newline convention does not affect the interpretation of
280    the \n or \r escape sequences.
281  </P>  </P>
282  <br><a name="SEC4" href="#TOC1">MULTITHREADING</a><br>  <br><a name="SEC4" href="#TOC1">MULTITHREADING</a><br>
283  <P>  <P>
# Line 286  The compiled form of a regular expressio Line 296  The compiled form of a regular expressio
296  time, possibly by a different program, and even on a host other than the one on  time, possibly by a different program, and even on a host other than the one on
297  which it was compiled. Details are given in the  which it was compiled. Details are given in the
298  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>
299  documentation.  documentation. However, compiling a regular expression with one version of PCRE
300    for use with a different version is not guaranteed to work and may cause
301    crashes.
302  </P>  </P>
303  <br><a name="SEC6" href="#TOC1">CHECKING BUILD-TIME OPTIONS</a><br>  <br><a name="SEC6" href="#TOC1">CHECKING BUILD-TIME OPTIONS</a><br>
304  <P>  <P>
# Line 317  properties is available; otherwise it is Line 329  properties is available; otherwise it is
329  </pre>  </pre>
330  The output is an integer whose value specifies the default character sequence  The output is an integer whose value specifies the default character sequence
331  that is recognized as meaning "newline". The four values that are supported  that is recognized as meaning "newline". The four values that are supported
332  are: 10 for LF, 13 for CR, 3338 for CRLF, and -1 for ANY. The default should  are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF, and -1 for ANY. The
333  normally be the standard sequence for your operating system.  default should normally be the standard sequence for your operating system.
334  <pre>  <pre>
335    PCRE_CONFIG_LINK_SIZE    PCRE_CONFIG_LINK_SIZE
336  </pre>  </pre>
# Line 546  occurrences of ^ or $ in a pattern, sett Line 558  occurrences of ^ or $ in a pattern, sett
558    PCRE_NEWLINE_CR    PCRE_NEWLINE_CR
559    PCRE_NEWLINE_LF    PCRE_NEWLINE_LF
560    PCRE_NEWLINE_CRLF    PCRE_NEWLINE_CRLF
561      PCRE_NEWLINE_ANYCRLF
562    PCRE_NEWLINE_ANY    PCRE_NEWLINE_ANY
563  </pre>  </pre>
564  These options override the default newline definition that was chosen when PCRE  These options override the default newline definition that was chosen when PCRE
565  was built. Setting the first or the second specifies that a newline is  was built. Setting the first or the second specifies that a newline is
566  indicated by a single character (CR or LF, respectively). Setting  indicated by a single character (CR or LF, respectively). Setting
567  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
568  CRLF sequence. Setting PCRE_NEWLINE_ANY specifies that any Unicode newline  CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies that any of the three
569  sequence should be recognized. The Unicode newline sequences are the three just  preceding sequences should be recognized. Setting PCRE_NEWLINE_ANY specifies
570  mentioned, plus the single characters VT (vertical tab, U+000B), FF (formfeed,  that any Unicode newline sequence should be recognized. The Unicode newline
571  U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS  sequences are the three just mentioned, plus the single characters VT (vertical
572  (paragraph separator, U+2029). The last two are recognized only in UTF-8 mode.  tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085), LS (line
573    separator, U+2028), and PS (paragraph separator, U+2029). The last two are
574    recognized only in UTF-8 mode.
575  </P>  </P>
576  <P>  <P>
577  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
578  as a number, giving eight possibilities. Currently only five are used (default  as a number, giving eight possibilities. Currently only six are used (default
579  plus the four values above). This means that if you set more than one newline  plus the five values above). This means that if you set more than one newline
580  option, the combination may or may not be sensible. For example,  option, the combination may or may not be sensible. For example,
581  PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but  PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to PCRE_NEWLINE_CRLF, but
582  other combinations yield unused numbers and cause an error.  other combinations may yield unused numbers and cause an error.
583  </P>  </P>
584  <P>  <P>
585  The only time that a line break is specially recognized when compiling a  The only time that a line break is specially recognized when compiling a
# Line 607  page. Line 622  page.
622    PCRE_NO_UTF8_CHECK    PCRE_NO_UTF8_CHECK
623  </pre>  </pre>
624  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
625  automatically checked. If an invalid UTF-8 sequence of bytes is found,  automatically checked. There is a discussion about the
626  <b>pcre_compile()</b> returns an error. If you already know that your pattern is  <a href="pcre.html#utf8strings">validity of UTF-8 strings</a>
627  valid, and you want to skip this check for performance reasons, you can set the  in the main
628  PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid  <a href="pcre.html"><b>pcre</b></a>
629  UTF-8 string as a pattern is undefined. It may cause your program to crash.  page. If an invalid UTF-8 sequence of bytes is found, <b>pcre_compile()</b>
630  Note that this option can also be passed to <b>pcre_exec()</b> and  returns an error. If you already know that your pattern is valid, and you want
631  <b>pcre_dfa_exec()</b>, to suppress the UTF-8 validity checking of subject  to skip this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK
632  strings.  option. When it is set, the effect of passing an invalid UTF-8 string as a
633    pattern is undefined. It may cause your program to crash. Note that this option
634    can also be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress
635    the UTF-8 validity checking of subject strings.
636  </P>  </P>
637  <br><a name="SEC8" href="#TOC1">COMPILATION ERROR CODES</a><br>  <br><a name="SEC8" href="#TOC1">COMPILATION ERROR CODES</a><br>
638  <P>  <P>
# Line 652  out of use. To avoid confusion, they hav Line 670  out of use. To avoid confusion, they hav
670    26  malformed number or name after (?(    26  malformed number or name after (?(
671    27  conditional group contains more than two branches    27  conditional group contains more than two branches
672    28  assertion expected after (?(    28  assertion expected after (?(
673    29  (?R or (?digits must be followed by )    29  (?R or (?[+-]digits must be followed by )
674    30  unknown POSIX class name    30  unknown POSIX class name
675    31  POSIX collating elements are not supported    31  POSIX collating elements are not supported
676    32  this version of PCRE is not compiled with PCRE_UTF8 support    32  this version of PCRE is not compiled with PCRE_UTF8 support
# Line 673  out of use. To avoid confusion, they hav Line 691  out of use. To avoid confusion, they hav
691    47  unknown property name after \P or \p    47  unknown property name after \P or \p
692    48  subpattern name is too long (maximum 32 characters)    48  subpattern name is too long (maximum 32 characters)
693    49  too many named subpatterns (maximum 10,000)    49  too many named subpatterns (maximum 10,000)
694    50  repeated subpattern is too long    50  [this code is not in use]
695    51  octal value is greater than \377 (not in UTF-8 mode)    51  octal value is greater than \377 (not in UTF-8 mode)
696    52  internal error: overran compiling workspace    52  internal error: overran compiling workspace
697    53  internal error: previously-checked referenced subpattern not found    53  internal error: previously-checked referenced subpattern not found
698    54  DEFINE group contains more than one branch    54  DEFINE group contains more than one branch
699    55  repeating a DEFINE group is not allowed    55  repeating a DEFINE group is not allowed
700    56  inconsistent NEWLINE options"    56  inconsistent NEWLINE options"
701      57  \g is not followed by a braced name or an optionally braced
702            non-zero number
703      58  (?+ or (?- or (?(+ or (?(- must be followed by a non-zero number
704  </PRE>  </PRE>
705  </P>  </P>
706  <br><a name="SEC9" href="#TOC1">STUDYING A PATTERN</a><br>  <br><a name="SEC9" href="#TOC1">STUDYING A PATTERN</a><br>
# Line 737  bytes is created. Line 758  bytes is created.
758  <a name="localesupport"></a></P>  <a name="localesupport"></a></P>
759  <br><a name="SEC10" href="#TOC1">LOCALE SUPPORT</a><br>  <br><a name="SEC10" href="#TOC1">LOCALE SUPPORT</a><br>
760  <P>  <P>
761  PCRE handles caseless matching, and determines whether characters are letters  PCRE handles caseless matching, and determines whether characters are letters,
762  digits, or whatever, by reference to a set of tables, indexed by character  digits, or whatever, by reference to a set of tables, indexed by character
763  value. When running in UTF-8 mode, this applies only to characters with codes  value. When running in UTF-8 mode, this applies only to characters with codes
764  less than 128. Higher-valued codes never match escapes such as \w or \d, but  less than 128. Higher-valued codes never match escapes such as \w or \d, but
765  can be tested with \p if PCRE is built with Unicode character property  can be tested with \p if PCRE is built with Unicode character property
766  support. The use of locales with Unicode is discouraged.  support. The use of locales with Unicode is discouraged. If you are handling
767  </P>  characters with codes greater than 128, you should either use UTF-8 and
768  <P>  Unicode, or use locales, but not try to mix the two.
769  An internal set of tables is created in the default C locale when PCRE is  </P>
770  built. This is used when the final argument of <b>pcre_compile()</b> is NULL,  <P>
771  and is sufficient for many applications. An alternative set of tables can,  PCRE contains an internal set of tables that are used when the final argument
772  however, be supplied. These may be created in a different locale from the  of <b>pcre_compile()</b> is NULL. These are sufficient for many applications.
773  default. As more and more applications change to using Unicode, the need for  Normally, the internal tables recognize only ASCII characters. However, when
774  this locale support is expected to die away.  PCRE is built, it is possible to cause the internal tables to be rebuilt in the
775    default "C" locale of the local system, which may cause them to be different.
776    </P>
777    <P>
778    The internal tables can always be overridden by tables supplied by the
779    application that calls PCRE. These may be created in a different locale from
780    the default. As more and more applications change to using Unicode, the need
781    for this locale support is expected to die away.
782  </P>  </P>
783  <P>  <P>
784  External tables are built by calling the <b>pcre_maketables()</b> function,  External tables are built by calling the <b>pcre_maketables()</b> function,
# Line 764  the following code could be used: Line 792  the following code could be used:
792    tables = pcre_maketables();    tables = pcre_maketables();
793    re = pcre_compile(..., tables);    re = pcre_compile(..., tables);
794  </pre>  </pre>
795    The locale name "fr_FR" is used on Linux and other Unix-like systems; if you
796    are using Windows, the name for the French locale is "french".
797    </P>
798    <P>
799  When <b>pcre_maketables()</b> runs, the tables are built in memory that is  When <b>pcre_maketables()</b> runs, the tables are built in memory that is
800  obtained via <b>pcre_malloc</b>. It is the caller's responsibility to ensure  obtained via <b>pcre_malloc</b>. It is the caller's responsibility to ensure
801  that the memory containing the tables remains available for as long as it is  that the memory containing the tables remains available for as long as it is
# Line 871  table indicating a fixed set of bytes fo Line 903  table indicating a fixed set of bytes fo
903  string, a pointer to the table is returned. Otherwise NULL is returned. The  string, a pointer to the table is returned. Otherwise NULL is returned. The
904  fourth argument should point to an <b>unsigned char *</b> variable.  fourth argument should point to an <b>unsigned char *</b> variable.
905  <pre>  <pre>
906      PCRE_INFO_HASCRORLF
907    </pre>
908    Return 1 if the pattern contains any explicit matches for CR or LF characters,
909    otherwise 0. The fourth argument should point to an <b>int</b> variable.
910    <pre>
911      PCRE_INFO_JCHANGED
912    </pre>
913    Return 1 if the (?J) option setting is used in the pattern, otherwise 0. The
914    fourth argument should point to an <b>int</b> variable. The (?J) internal option
915    setting changes the local PCRE_DUPNAMES option.
916    <pre>
917    PCRE_INFO_LASTLITERAL    PCRE_INFO_LASTLITERAL
918  </pre>  </pre>
919  Return the value of the rightmost literal byte that must exist in any matched  Return the value of the rightmost literal byte that must exist in any matched
# Line 922  When writing code to extract data from n Line 965  When writing code to extract data from n
965  name-to-number map, remember that the length of the entries is likely to be  name-to-number map, remember that the length of the entries is likely to be
966  different for each compiled pattern.  different for each compiled pattern.
967  <pre>  <pre>
968      PCRE_INFO_OKPARTIAL
969    </pre>
970    Return 1 if the pattern can be used for partial matching, otherwise 0. The
971    fourth argument should point to an <b>int</b> variable. The
972    <a href="pcrepartial.html"><b>pcrepartial</b></a>
973    documentation lists the restrictions that apply to patterns when partial
974    matching is used.
975    <pre>
976    PCRE_INFO_OPTIONS    PCRE_INFO_OPTIONS
977  </pre>  </pre>
978  Return a copy of the options with which the pattern was compiled. The fourth  Return a copy of the options with which the pattern was compiled. The fourth
979  argument should point to an <b>unsigned long int</b> variable. These option bits  argument should point to an <b>unsigned long int</b> variable. These option bits
980  are those specified in the call to <b>pcre_compile()</b>, modified by any  are those specified in the call to <b>pcre_compile()</b>, modified by any
981  top-level option settings within the pattern itself.  top-level option settings at the start of the pattern itself. In other words,
982    they are the options that will be in force when matching starts. For example,
983    if the pattern /(?im)abc(?-i)d/ is compiled with the PCRE_EXTENDED option, the
984    result is PCRE_CASELESS, PCRE_MULTILINE, and PCRE_EXTENDED.
985  </P>  </P>
986  <P>  <P>
987  A pattern is automatically anchored by PCRE if all of its top-level  A pattern is automatically anchored by PCRE if all of its top-level
# Line 1136  the external tables might be at a differ Line 1190  the external tables might be at a differ
1190  called. See the  called. See the
1191  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>  <a href="pcreprecompile.html"><b>pcreprecompile</b></a>
1192  documentation for a discussion of saving compiled patterns for later use.  documentation for a discussion of saving compiled patterns for later use.
1193  </P>  <a name="execoptions"></a></P>
1194  <br><b>  <br><b>
1195  Option bits for <b>pcre_exec()</b>  Option bits for <b>pcre_exec()</b>
1196  </b><br>  </b><br>
# Line 1155  matching time. Line 1209  matching time.
1209    PCRE_NEWLINE_CR    PCRE_NEWLINE_CR
1210    PCRE_NEWLINE_LF    PCRE_NEWLINE_LF
1211    PCRE_NEWLINE_CRLF    PCRE_NEWLINE_CRLF
1212      PCRE_NEWLINE_ANYCRLF
1213    PCRE_NEWLINE_ANY    PCRE_NEWLINE_ANY
1214  </pre>  </pre>
1215  These options override the newline definition that was chosen or defaulted when  These options override the newline definition that was chosen or defaulted when
# Line 1162  the pattern was compiled. For details, s Line 1217  the pattern was compiled. For details, s
1217  <b>pcre_compile()</b> above. During matching, the newline choice affects the  <b>pcre_compile()</b> above. During matching, the newline choice affects the
1218  behaviour of the dot, circumflex, and dollar metacharacters. It may also alter  behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
1219  the way the match position is advanced after a match failure for an unanchored  the way the match position is advanced after a match failure for an unanchored
1220  pattern. When PCRE_NEWLINE_CRLF or PCRE_NEWLINE_ANY is set, and a match attempt  pattern.
1221  fails when the current position is at a CRLF sequence, the match position is  </P>
1222  advanced by two characters instead of one, in other words, to after the CRLF.  <P>
1223    When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is set, and a
1224    match attempt for an unanchored pattern fails when the current position is at a
1225    CRLF sequence, and the pattern contains no explicit matches for CR or NL
1226    characters, the match position is advanced by two characters instead of one, in
1227    other words, to after the CRLF.
1228    </P>
1229    <P>
1230    The above rule is a compromise that makes the most common cases work as
1231    expected. For example, if the pattern is .+A (and the PCRE_DOTALL option is not
1232    set), it does not match the string "\r\nA" because, after failing at the
1233    start, it skips both the CR and the LF before retrying. However, the pattern
1234    [\r\n]A does match that string, because it contains an explicit CR or LF
1235    reference, and so advances only by one character after the first failure.
1236    Note than an explicit CR or LF reference occurs for negated character classes
1237    such as [^X] because they can match CR or LF characters.
1238    </P>
1239    <P>
1240    Notwithstanding the above, anomalous effects may still occur when CRLF is a
1241    valid newline sequence and explicit \r or \n escapes appear in the pattern.
1242  <pre>  <pre>
1243    PCRE_NOTBOL    PCRE_NOTBOL
1244  </pre>  </pre>
# Line 1208  code that demonstrates how to do this in Line 1282  code that demonstrates how to do this in
1282  When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8  When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8
1283  string is automatically checked when <b>pcre_exec()</b> is subsequently called.  string is automatically checked when <b>pcre_exec()</b> is subsequently called.
1284  The value of <i>startoffset</i> is also checked to ensure that it points to the  The value of <i>startoffset</i> is also checked to ensure that it points to the
1285  start of a UTF-8 character. If an invalid UTF-8 sequence of bytes is found,  start of a UTF-8 character. There is a discussion about the validity of UTF-8
1286  <b>pcre_exec()</b> returns the error PCRE_ERROR_BADUTF8. If <i>startoffset</i>  strings in the
1287  contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.  <a href="pcre.html#utf8strings">section on UTF-8 support</a>
1288    in the main
1289    <a href="pcre.html"><b>pcre</b></a>
1290    page. If an invalid UTF-8 sequence of bytes is found, <b>pcre_exec()</b> returns
1291    the error PCRE_ERROR_BADUTF8. If <i>startoffset</i> contains an invalid value,
1292    PCRE_ERROR_BADUTF8_OFFSET is returned.
1293  </P>  </P>
1294  <P>  <P>
1295  If you already know that your subject is valid, and you want to skip these  If you already know that your subject is valid, and you want to skip these
# Line 1448  The internal recursion limit, as specifi Line 1527  The internal recursion limit, as specifi
1527  field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the  field in a <b>pcre_extra</b> structure (or defaulted) was reached. See the
1528  description above.  description above.
1529  <pre>  <pre>
   PCRE_ERROR_NULLWSLIMIT    (-22)  
 </pre>  
 When a group that can match an empty substring is repeated with an unbounded  
 upper limit, the subject position at the start of the group must be remembered,  
 so that a test for an empty string can be made when the end of the group is  
 reached. Some workspace is required for this; if it runs out, this error is  
 given.  
 <pre>  
1530    PCRE_ERROR_BADNEWLINE     (-23)    PCRE_ERROR_BADNEWLINE     (-23)
1531  </pre>  </pre>
1532  An invalid combination of PCRE_NEWLINE_<i>xxx</i> options was given.  An invalid combination of PCRE_NEWLINE_<i>xxx</i> options was given.
1533  </P>  </P>
1534  <P>  <P>
1535  Error numbers -16 to -20 are not used by <b>pcre_exec()</b>.  Error numbers -16 to -20 and -22 are not used by <b>pcre_exec()</b>.
1536  </P>  </P>
1537  <br><a name="SEC15" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>  <br><a name="SEC15" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
1538  <P>  <P>
# Line 1607  translation table. Line 1678  translation table.
1678  </P>  </P>
1679  <P>  <P>
1680  These functions call <b>pcre_get_stringnumber()</b>, and if it succeeds, they  These functions call <b>pcre_get_stringnumber()</b>, and if it succeeds, they
1681  then call <i>pcre_copy_substring()</i> or <i>pcre_get_substring()</i>, as  then call <b>pcre_copy_substring()</b> or <b>pcre_get_substring()</b>, as
1682  appropriate.  appropriate. <b>NOTE:</b> If PCRE_DUPNAMES is set and there are duplicate names,
1683    the behaviour may not be what you want (see the next section).
1684  </P>  </P>
1685  <br><a name="SEC17" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>  <br><a name="SEC17" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>
1686  <P>  <P>
# Line 1621  are not required to be unique. Normally, Line 1693  are not required to be unique. Normally,
1693  that in any one match, only one of the named subpatterns participates. An  that in any one match, only one of the named subpatterns participates. An
1694  example is shown in the  example is shown in the
1695  <a href="pcrepattern.html"><b>pcrepattern</b></a>  <a href="pcrepattern.html"><b>pcrepattern</b></a>
1696  documentation. When duplicates are present, <b>pcre_copy_named_substring()</b>  documentation.
1697  and <b>pcre_get_named_substring()</b> return the first substring corresponding  </P>
1698  to the given name that is set. If none are set, an empty string is returned.  <P>
1699  The <b>pcre_get_stringnumber()</b> function returns one of the numbers that are  When duplicates are present, <b>pcre_copy_named_substring()</b> and
1700  associated with the name, but it is not defined which it is.  <b>pcre_get_named_substring()</b> return the first substring corresponding to
1701  <br>  the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING (-7) is
1702  <br>  returned; no data is returned. The <b>pcre_get_stringnumber()</b> function
1703    returns one of the numbers that are associated with the name, but it is not
1704    defined which it is.
1705    </P>
1706    <P>
1707  If you want to get full details of all captured substrings for a given name,  If you want to get full details of all captured substrings for a given name,
1708  you must use the <b>pcre_get_stringtable_entries()</b> function. The first  you must use the <b>pcre_get_stringtable_entries()</b> function. The first
1709  argument is the compiled pattern, and the second is the name. The third and  argument is the compiled pattern, and the second is the name. The third and
# Line 1839  Cambridge CB2 3QH, England. Line 1915  Cambridge CB2 3QH, England.
1915  </P>  </P>
1916  <br><a name="SEC22" href="#TOC1">REVISION</a><br>  <br><a name="SEC22" href="#TOC1">REVISION</a><br>
1917  <P>  <P>
1918  Last updated: 06 March 2007  Last updated: 21 August 2007
1919  <br>  <br>
1920  Copyright &copy; 1997-2007 University of Cambridge.  Copyright &copy; 1997-2007 University of Cambridge.
1921  <br>  <br>

Legend:
Removed from v.99  
changed lines
  Added in v.227

  ViewVC Help
Powered by ViewVC 1.1.5