diff options
Diffstat (limited to 'doc/pcrepartial.3')
-rw-r--r-- | doc/pcrepartial.3 | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/doc/pcrepartial.3 b/doc/pcrepartial.3 index c4e0aca..c52a1cd 100644 --- a/doc/pcrepartial.3 +++ b/doc/pcrepartial.3 @@ -95,8 +95,9 @@ uses the date example quoted above: .sp The first data string is matched completely, so \fBpcretest\fP 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 \eD escape sequence), produces the following output: +pattern, but the first two are partial matches. The same test, using +\fBpcre_dfa_exec()\fP matching (by means of the \eD escape sequence), produces +the following output: .sp re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/ data> 25jun04\eP\eD @@ -119,11 +120,11 @@ available. .sp When a partial match has been found using \fBpcre_dfa_exec()\fP, it is possible to continue the match by providing additional subject data and calling -\fBpcre_dfa_exec()\fP 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 \fBpcretest\fP, where the \eR escape sequence sets the -PCRE_DFA_RESTART option and the \eD escape sequence requests the use of -\fBpcre_dfa_exec()\fP: +\fBpcre_dfa_exec()\fP 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 \fBpcretest\fP, using the \eR escape +sequence to set the PCRE_DFA_RESTART option (\eP and \eD are as above): .sp re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/ data> 23ja\eP\eD @@ -137,9 +138,10 @@ Notice that when the match is complete, only the last part is shown; PCRE does not retain the previously partially-matched string. It is up to the calling program to do that if it needs to. .P -This facility can be used to pass very long subject strings to -\fBpcre_dfa_exec()\fP. 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 \fBpcre_dfa_exec()\fP. However, some care is needed for certain +types of pattern. .P 1. If the pattern contains tests for the beginning or end of a line, you need to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropriate, when the @@ -147,7 +149,7 @@ subject string for any call does not contain the beginning or end of a line. .P 2. If the pattern contains backward assertions (including \eb or \eB), 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. .P @@ -198,6 +200,6 @@ where no string can be a partial match for both alternatives. . .P .in 0 -Last updated: 16 January 2006 +Last updated: 30 November 2006 .br Copyright (c) 1997-2006 University of Cambridge. |