--- code/trunk/doc/html/pcrepartial.html 2007/02/24 21:41:36 92 +++ code/trunk/doc/html/pcrepartial.html 2007/02/24 21:41:42 93 @@ -112,8 +112,9 @@ The first data string is matched completely, so pcretest shows the matched substrings. The remaining four strings do not match the complete -pattern, but the first two are partial matches. The same test, using DFA -matching (by means of the \D escape sequence), produces the following output: +pattern, but the first two are partial matches. The same test, using +pcre_dfa_exec() matching (by means of the \D escape sequence), produces +the following output:
     re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
   data> 25jun04\P\D
@@ -134,11 +135,11 @@
 

When a partial match has been found using pcre_dfa_exec(), it is possible to continue the match by providing additional subject data and calling -pcre_dfa_exec() again with the PCRE_DFA_RESTART option and the same -working space (where details of the previous partial match are stored). Here is -an example using pcretest, where the \R escape sequence sets the -PCRE_DFA_RESTART option and the \D escape sequence requests the use of -pcre_dfa_exec(): +pcre_dfa_exec() again with the same compiled regular expression, this +time setting the PCRE_DFA_RESTART option. You must also pass the same working +space as before, because this is where details of the previous partial match +are stored. Here is an example using pcretest, using the \R escape +sequence to set the PCRE_DFA_RESTART option (\P and \D are as above):

     re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
   data> 23ja\P\D
@@ -153,9 +154,10 @@
 program to do that if it needs to.
 

-This facility can be used to pass very long subject strings to -pcre_dfa_exec(). However, some care is needed for certain types of -pattern. +You can set PCRE_PARTIAL with PCRE_DFA_RESTART to continue partial matching +over multiple segments. This facility can be used to pass very long subject +strings to pcre_dfa_exec(). However, some care is needed for certain +types of pattern.

1. If the pattern contains tests for the beginning or end of a line, you need @@ -165,7 +167,7 @@

2. If the pattern contains backward assertions (including \b or \B), you need to arrange for some overlap in the subject strings to allow for this. For -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 a buffer of 700 bytes, with the starting offset set to 200 and the previous 200 bytes at the start of the buffer.

@@ -217,7 +219,7 @@ where no string can be a partial match for both alternatives.

-Last updated: 16 January 2006 +Last updated: 30 November 2006
Copyright © 1997-2006 University of Cambridge.