Documentation update.

This commit is contained in:
Philip.Hazel 2017-03-21 12:21:55 +00:00
parent 131209e22d
commit 20cafacaa4
1 changed files with 21 additions and 25 deletions

View File

@ -1,4 +1,4 @@
.TH PCRE2GREP 1 "31 December 2016" "PCRE2 10.23" .TH PCRE2GREP 1 "21 March 2017" "PCRE2 10.30"
.SH NAME .SH NAME
pcre2grep - a grep with Perl-compatible regular expressions. pcre2grep - a grep with Perl-compatible regular expressions.
.SH SYNOPSIS .SH SYNOPSIS
@ -236,6 +236,9 @@ compatibility with GNU grep), "recurse" (equivalent to the \fB-r\fP option), or
operating systems the effect of reading a directory like this is an immediate operating systems the effect of reading a directory like this is an immediate
end-of-file; in others it may provoke an error. end-of-file; in others it may provoke an error.
.TP .TP
\fB--depth-limit\fP=\fInumber\fP
See \fB--match-limit\fP below.
.TP
\fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP \fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP
Specify a pattern to be matched. This option can be used multiple times in Specify a pattern to be matched. This option can be used multiple times in
order to specify several patterns. It can also be used as a way of specifying a order to specify several patterns. It can also be used as a way of specifying a
@ -430,27 +433,20 @@ locale is specified, the PCRE2 library's default (usually the "C" locale) is
used. There is no short form for this option. used. There is no short form for this option.
.TP .TP
\fB--match-limit\fP=\fInumber\fP \fB--match-limit\fP=\fInumber\fP
Processing some regular expression patterns can require a very large amount of Processing some regular expression patterns may take a very long time to search
memory, leading in some cases to a program crash if not enough is available. for all possible matching strings. Others may require a very large amount of
Other patterns may take a very long time to search for all possible matching memory. There are two options that set resource limits for matching.
strings. The \fBpcre2_match()\fP function that is called by \fBpcre2grep\fP to
do the matching has two parameters that can limit the resources that it uses.
.sp .sp
The \fB--match-limit\fP option provides a means of limiting resource usage The \fB--match-limit\fP option provides a means of limiting computing resource
when processing patterns that are not going to match, but which have a very usage when processing patterns that are not going to match, but which have a
large number of possibilities in their search trees. The classic example is a very large number of possibilities in their search trees. The classic example
pattern that uses nested unlimited repeats. Internally, PCRE2 uses a function is a pattern that uses nested unlimited repeats. Internally, PCRE2 has a
called \fBmatch()\fP which it calls repeatedly (sometimes recursively). The counter that is incremented each time around its main processing loop. If the
limit set by \fB--match-limit\fP is imposed on the number of times this value set by \fB--match-limit\fP is reached, an error occurs.
function is called during a match, which has the effect of limiting the amount
of backtracking that can take place.
.sp .sp
The \fB--recursion-limit\fP option is similar to \fB--match-limit\fP, but The \fB--depth-limit\fP option limits the depth of nested backtracking points,
instead of limiting the total number of times that \fBmatch()\fP is called, it which in turn limits the amount of memory that is used. This limit is of use
limits the depth of recursive calls, which in turn limits the amount of memory only if it is set smaller than \fB--match-limit\fP.
that can be used. The recursion depth is a smaller number than the total number
of calls, because not all calls to \fBmatch()\fP are recursive. This limit is
of use only if it is set smaller than \fB--match-limit\fP.
.sp .sp
There are no short forms for these options. The default settings are specified There are no short forms for these options. The default settings are specified
when the PCRE2 library is compiled, with the default default being 10 million. when the PCRE2 library is compiled, with the default default being 10 million.
@ -758,9 +754,9 @@ message and the line that caused the problem to the standard error stream. If
there are more than 20 such errors, \fBpcre2grep\fP gives up. there are more than 20 such errors, \fBpcre2grep\fP gives up.
.P .P
The \fB--match-limit\fP option of \fBpcre2grep\fP can be used to set the The \fB--match-limit\fP option of \fBpcre2grep\fP can be used to set the
overall resource limit; there is a second option called \fB--recursion-limit\fP overall resource limit; there is a second option called \fB--depth-limit\fP
that sets a limit on the amount of memory (usually stack) that is used (see the that sets a limit on the amount of memory that is used (see the discussion of
discussion of these options above). these options above).
. .
. .
.SH DIAGNOSTICS .SH DIAGNOSTICS
@ -793,6 +789,6 @@ Cambridge, England.
.rs .rs
.sp .sp
.nf .nf
Last updated: 31 December 2016 Last updated: 21 March 2017
Copyright (c) 1997-2016 University of Cambridge. Copyright (c) 1997-2017 University of Cambridge.
.fi .fi