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

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

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

revision 87 by nigel, Sat Feb 24 21:41:21 2007 UTC revision 93 by nigel, Sat Feb 24 21:41:42 2007 UTC
# Line 112  uses the date example quoted above: Line 112  uses the date example quoted above:
112  </pre>  </pre>
113  The first data string is matched completely, so <b>pcretest</b> shows the  The first data string is matched completely, so <b>pcretest</b> shows the
114  matched substrings. The remaining four strings do not match the complete  matched substrings. The remaining four strings do not match the complete
115  pattern, but the first two are partial matches. The same test, using DFA  pattern, but the first two are partial matches. The same test, using
116  matching (by means of the \D escape sequence), produces the following output:  <b>pcre_dfa_exec()</b> matching (by means of the \D escape sequence), produces
117    the following output:
118  <pre>  <pre>
119      re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/      re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
120    data&#62; 25jun04\P\D    data&#62; 25jun04\P\D
# Line 134  available. Line 135  available.
135  <P>  <P>
136  When a partial match has been found using <b>pcre_dfa_exec()</b>, it is possible  When a partial match has been found using <b>pcre_dfa_exec()</b>, it is possible
137  to continue the match by providing additional subject data and calling  to continue the match by providing additional subject data and calling
138  <b>pcre_dfa_exec()</b> again with the PCRE_DFA_RESTART option and the same  <b>pcre_dfa_exec()</b> again with the same compiled regular expression, this
139  working space (where details of the previous partial match are stored). Here is  time setting the PCRE_DFA_RESTART option. You must also pass the same working
140  an example using <b>pcretest</b>, where the \R escape sequence sets the  space as before, because this is where details of the previous partial match
141  PCRE_DFA_RESTART option and the \D escape sequence requests the use of  are stored. Here is an example using <b>pcretest</b>, using the \R escape
142  <b>pcre_dfa_exec()</b>:  sequence to set the PCRE_DFA_RESTART option (\P and \D are as above):
143  <pre>  <pre>
144      re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/      re&#62; /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
145    data&#62; 23ja\P\D    data&#62; 23ja\P\D
# Line 153  not retain the previously partially-matc Line 154  not retain the previously partially-matc
154  program to do that if it needs to.  program to do that if it needs to.
155  </P>  </P>
156  <P>  <P>
157  This facility can be used to pass very long subject strings to  You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching
158  <b>pcre_dfa_exec()</b>. However, some care is needed for certain types of  over multiple segments. This facility can be used to pass very long subject
159  pattern.  strings to <b>pcre_dfa_exec()</b>. However, some care is needed for certain
160    types of pattern.
161  </P>  </P>
162  <P>  <P>
163  1. If the pattern contains tests for the beginning or end of a line, you need  1. If the pattern contains tests for the beginning or end of a line, you need
# Line 165  subject string for any call does not con Line 167  subject string for any call does not con
167  <P>  <P>
168  2. If the pattern contains backward assertions (including \b or \B), you need  2. If the pattern contains backward assertions (including \b or \B), you need
169  to arrange for some overlap in the subject strings to allow for this. For  to arrange for some overlap in the subject strings to allow for this. For
170  example, you could pass the subject in chunks that were 500 bytes long, but in  example, you could pass the subject in chunks that are 500 bytes long, but in
171  a buffer of 700 bytes, with the starting offset set to 200 and the previous 200  a buffer of 700 bytes, with the starting offset set to 200 and the previous 200
172  bytes at the start of the buffer.  bytes at the start of the buffer.
173  </P>  </P>
# Line 217  patterns or patterns such as: Line 219  patterns or patterns such as:
219  where no string can be a partial match for both alternatives.  where no string can be a partial match for both alternatives.
220  </P>  </P>
221  <P>  <P>
222  Last updated: 16 January 2006  Last updated: 30 November 2006
223  <br>  <br>
224  Copyright &copy; 1997-2006 University of Cambridge.  Copyright &copy; 1997-2006 University of Cambridge.
225  <p>  <p>

Legend:
Removed from v.87  
changed lines
  Added in v.93

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12