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

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

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

revision 454 by ph10, Tue Sep 22 09:42:11 2009 UTC revision 455 by ph10, Sat Sep 26 19:12:32 2009 UTC
# Line 772  help speed up matching, \fBpcre_study()\ Line 772  help speed up matching, \fBpcre_study()\
772  results of the study.  results of the study.
773  .P  .P
774  The returned value from \fBpcre_study()\fP can be passed directly to  The returned value from \fBpcre_study()\fP can be passed directly to
775  \fBpcre_exec()\fP. However, a \fBpcre_extra\fP block also contains other  \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP. However, a \fBpcre_extra\fP block
776  fields that can be set by the caller before the block is passed; these are  also contains other fields that can be set by the caller before the block is
777  described  passed; these are described
778  .\" HTML <a href="#extradata">  .\" HTML <a href="#extradata">
779  .\" </a>  .\" </a>
780  below  below
781  .\"  .\"
782  in the section on matching a pattern.  in the section on matching a pattern.
783  .P  .P
784  If studying the pattern does not produce any additional information  If studying the pattern does not produce any useful information,
785  \fBpcre_study()\fP returns NULL. In that circumstance, if the calling program  \fBpcre_study()\fP returns NULL. In that circumstance, if the calling program
786  wants to pass any of the other fields to \fBpcre_exec()\fP, it must set up its  wants to pass any of the other fields to \fBpcre_exec()\fP or
787  own \fBpcre_extra\fP block.  \fBpcre_dfa_exec()\fP, it must set up its own \fBpcre_extra\fP block.
788  .P  .P
789  The second argument of \fBpcre_study()\fP contains option bits. At present, no  The second argument of \fBpcre_study()\fP contains option bits. At present, no
790  options are defined, and this argument should always be zero.  options are defined, and this argument should always be zero.
# Line 804  This is a typical call to \fBpcre_study\ Line 804  This is a typical call to \fBpcre_study\
804      0,              /* no options exist */      0,              /* no options exist */
805      &error);        /* set to NULL or points to a message */      &error);        /* set to NULL or points to a message */
806  .sp  .sp
807  At present, studying a pattern is useful only for non-anchored patterns that do  Studying a pattern does two things: first, a lower bound for the length of
808  not have a single fixed starting character. A bitmap of possible starting  subject string that is needed to match the pattern is computed. This does not
809  bytes is created.  mean that there are any strings of that length that match, but it does
810    guarantee that no shorter strings match. The value is used by
811    \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP to avoid wasting time by trying to
812    match strings that are shorter than the lower bound. You can find out the value
813    in a calling program via the \fBpcre_fullinfo()\fP function.
814    .P
815    Studying a pattern is also useful for non-anchored patterns that do not have a
816    single fixed starting character. A bitmap of possible starting bytes is
817    created. This speeds up finding a position in the subject at which to start
818    matching.
819  .  .
820  .  .
821  .\" HTML <a name="localesupport"></a>  .\" HTML <a name="localesupport"></a>
# Line 971  follows something of variable length. Fo Line 980  follows something of variable length. Fo
980  /^a\ed+z\ed+/ the returned value is "z", but for /^a\edz\ed/ the returned value  /^a\ed+z\ed+/ the returned value is "z", but for /^a\edz\ed/ the returned value
981  is -1.  is -1.
982  .sp  .sp
983      PCRE_INFO_MINLENGTH
984    .sp
985    If the pattern was studied and a minimum length for matching subject strings
986    was computed, its value is returned. Otherwise the returned value is -1. The
987    value is a number of characters, not bytes (there may be a difference in UTF-8
988    mode). The fourth argument should point to an \fBint\fP variable. A
989    non-negative value is a lower bound to the length of any matching string. There
990    may not be any strings of that length that do actually match, but every string
991    that does match is at least that long.
992    .sp
993    PCRE_INFO_NAMECOUNT    PCRE_INFO_NAMECOUNT
994    PCRE_INFO_NAMEENTRYSIZE    PCRE_INFO_NAMEENTRYSIZE
995    PCRE_INFO_NAMETABLE    PCRE_INFO_NAMETABLE
# Line 1059  variable. Line 1078  variable.
1078  Return the size of the data block pointed to by the \fIstudy_data\fP field in  Return the size of the data block pointed to by the \fIstudy_data\fP field in
1079  a \fBpcre_extra\fP block. That is, it is the value that was passed to  a \fBpcre_extra\fP block. That is, it is the value that was passed to
1080  \fBpcre_malloc()\fP when PCRE was getting memory into which to place the data  \fBpcre_malloc()\fP when PCRE was getting memory into which to place the data
1081  created by \fBpcre_study()\fP. The fourth argument should point to a  created by \fBpcre_study()\fP. If \fBpcre_extra\fP is NULL, or there is no
1082    study data, zero is returned. The fourth argument should point to a
1083  \fBsize_t\fP variable.  \fBsize_t\fP variable.
1084  .  .
1085  .  .
# Line 1121  is different. (This seems a highly unlik Line 1141  is different. (This seems a highly unlik
1141  .P  .P
1142  The function \fBpcre_exec()\fP is called to match a subject string against a  The function \fBpcre_exec()\fP is called to match a subject string against a
1143  compiled pattern, which is passed in the \fIcode\fP argument. If the  compiled pattern, which is passed in the \fIcode\fP argument. If the
1144  pattern has been studied, the result of the study should be passed in the  pattern was studied, the result of the study should be passed in the
1145  \fIextra\fP argument. This function is the main matching facility of the  \fIextra\fP argument. This function is the main matching facility of the
1146  library, and it operates in a Perl-like manner. For specialist use there is  library, and it operates in a Perl-like manner. For specialist use there is
1147  also an alternative matching function, which is described  also an alternative matching function, which is described
# Line 2023  Cambridge CB2 3QH, England. Line 2043  Cambridge CB2 3QH, England.
2043  .rs  .rs
2044  .sp  .sp
2045  .nf  .nf
2046  Last updated: 22 September 2009  Last updated: 26 September 2009
2047  Copyright (c) 1997-2009 University of Cambridge.  Copyright (c) 1997-2009 University of Cambridge.
2048  .fi  .fi

Legend:
Removed from v.454  
changed lines
  Added in v.455

  ViewVC Help
Powered by ViewVC 1.1.5