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

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

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

revision 566 by ph10, Thu Jun 3 19:18:24 2010 UTC revision 567 by ph10, Sat Nov 6 17:10:00 2010 UTC
# Line 366  locale is specified, the PCRE library's Line 366  locale is specified, the PCRE library's
366  used. There is no short form for this option.  used. There is no short form for this option.
367  </P>  </P>
368  <P>  <P>
369    <b>--match-limit</b>=<i>number</i>
370    Processing some regular expression patterns can require a very large amount of
371    memory, leading in some cases to a program crash if not enough is available.
372    Other patterns may take a very long time to search for all possible matching
373    strings. The <b>pcre_exec()</b> function that is called by <b>pcregrep</b> to do
374    the matching has two parameters that can limit the resources that it uses.
375    <br>
376    <br>
377    The <b>--match-limit</b> option provides a means of limiting resource usage
378    when processing patterns that are not going to match, but which have a very
379    large number of possibilities in their search trees. The classic example is a
380    pattern that uses nested unlimited repeats. Internally, PCRE uses a function
381    called <b>match()</b> which it calls repeatedly (sometimes recursively). The
382    limit set by \fb--match-limit\fP is imposed on the number of times this
383    function is called during a match, which has the effect of limiting the amount
384    of backtracking that can take place.
385    <br>
386    <br>
387    The <b>--recursion-limit</b> option is similar to <b>--match-limit</b>, but
388    instead of limiting the total number of times that <b>match()</b> is called, it
389    limits the depth of recursive calls, which in turn limits the amount of memory
390    that can be used. The recursion depth is a smaller number than the total number
391    of calls, because not all calls to <b>match()</b> are recursive. This limit is
392    of use only if it is set smaller than <b>--match-limit</b>.
393    <br>
394    <br>
395    There are no short forms for these options. The default settings are specified
396    when the PCRE library is compiled, with the default default being 10 million.
397    </P>
398    <P>
399  <b>-M</b>, <b>--multiline</b>  <b>-M</b>, <b>--multiline</b>
400  Allow patterns to match more than one line. When this option is given, patterns  Allow patterns to match more than one line. When this option is given, patterns
401  may usefully contain literal newline characters and internal occurrences of ^  may usefully contain literal newline characters and internal occurrences of ^
# Line 380  are guaranteed to be available for lookb Line 410  are guaranteed to be available for lookb
410  work when input is read line by line (see \fP--line-buffered\fP.)  work when input is read line by line (see \fP--line-buffered\fP.)
411  </P>  </P>
412  <P>  <P>
413  <b>-N</b> <i>newline-type</i>, <b>--newline=</b><i>newline-type</i>  <b>-N</b> <i>newline-type</i>, <b>--newline</b>=<i>newline-type</i>
414  The PCRE library supports five different conventions for indicating  The PCRE library supports five different conventions for indicating
415  the ends of lines. They are the single-character sequences CR (carriage return)  the ends of lines. They are the single-character sequences CR (carriage return)
416  and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,  and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
# Line 409  output, it precedes the line number. Thi Line 439  output, it precedes the line number. Thi
439  </P>  </P>
440  <P>  <P>
441  <b>-o</b>, <b>--only-matching</b>  <b>-o</b>, <b>--only-matching</b>
442  Show only the part of the line that matched a pattern. In this mode, no  Show only the part of the line that matched a pattern instead of the whole
443  context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are  line. In this mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>, and
444  ignored. If there is more than one match in a line, each of them is shown  <b>-C</b> options are ignored. If there is more than one match in a line, each
445  separately. If <b>-o</b> is combined with <b>-v</b> (invert the sense of the  of them is shown separately. If <b>-o</b> is combined with <b>-v</b> (invert the
446  match to find non-matching lines), no output is generated, but the return code  sense of the match to find non-matching lines), no output is generated, but the
447  is set appropriately. This option is mutually exclusive with  return code is set appropriately. If the matched portion of the line is empty,
448  <b>--file-offsets</b> and <b>--line-offsets</b>.  nothing is output unless the file name or line number are being printed, in
449    which case they are shown on an otherwise empty line. This option is mutually
450    exclusive with <b>--file-offsets</b> and <b>--line-offsets</b>.
451    </P>
452    <P>
453    <b>-o</b><i>number</i>, <b>--only-matching</b>=<i>number</i>
454    Show only the part of the line that matched the capturing parentheses of the
455    given number. Up to 32 capturing parentheses are supported. Because these
456    options can be given without an argument (see above), if an argument is
457    present, it must be given in the same shell item, for example, -o3 or
458    --only-matching=2. The comments given for the non-argument case above also
459    apply to this case. If the specified capturing parentheses do not exist in the
460    pattern, or were not set in the match, nothing is output unless the file name
461    or line number are being printed.
462  </P>  </P>
463  <P>  <P>
464  <b>-q</b>, <b>--quiet</b>  <b>-q</b>, <b>--quiet</b>
# Line 431  immediate end-of-file. This option is a Line 474  immediate end-of-file. This option is a
474  option to "recurse".  option to "recurse".
475  </P>  </P>
476  <P>  <P>
477    <b>--recursion-limit</b>=<i>number</i>
478    See <b>--match-limit</b> above.
479    </P>
480    <P>
481  <b>-s</b>, <b>--no-messages</b>  <b>-s</b>, <b>--no-messages</b>
482  Suppress error messages about non-existent or unreadable files. Such files are  Suppress error messages about non-existent or unreadable files. Such files are
483  quietly skipped. However, the return code is still 2, even if matches were  quietly skipped. However, the return code is still 2, even if matches were
# Line 550  Cambridge CB2 3QH, England. Line 597  Cambridge CB2 3QH, England.
597  </P>  </P>
598  <br><a name="SEC13" href="#TOC1">REVISION</a><br>  <br><a name="SEC13" href="#TOC1">REVISION</a><br>
599  <P>  <P>
600  Last updated: 21 May 2010  Last updated: 31 October 2010
601  <br>  <br>
602  Copyright &copy; 1997-2010 University of Cambridge.  Copyright &copy; 1997-2010 University of Cambridge.
603  <br>  <br>

Legend:
Removed from v.566  
changed lines
  Added in v.567

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12