Perl-совместимые регулярные выражения (Perl-compatible regular expressions)
LIMITING PCRE RESOURCE USAGE
Internally, PCRE has a function called match()
, which it calls
repeatedly (sometimes recursively) when matching a pattern with
the pcre_exec()
function. By controlling the maximum number of
times this function may be called during a single matching
operation, a limit can be placed on the resources used by a
single call to pcre_exec()
. The limit can be changed at run time,
as described in the pcreapi
documentation. The default is 10
million, but this can be changed by adding a setting such as
--with-match-limit=500000
to the configure
command. This setting has no effect on the
pcre_dfa_exec()
matching function.
In some environments it is desirable to limit the depth of
recursive calls of match()
more strictly than the total number of
calls, in order to restrict the maximum amount of stack (or heap,
if --disable-stack-for-recursion is specified) that is used. A
second limit controls this; it defaults to the value that is set
for --with-match-limit, which imposes no additional constraints.
However, you can set a lower limit by adding, for example,
--with-match-limit-recursion=10000
to the configure
command. This value can also be overridden at
run time.