|
1 | | -.TH PCRE2GREP 1 "20 November 2023" "PCRE2 10.43" |
| 1 | +.TH PCRE2GREP 1 "22 December 2023" "PCRE2 10.43" |
2 | 2 | .SH NAME |
3 | 3 | pcre2grep - a grep with Perl-compatible regular expressions. |
4 | 4 | .SH SYNOPSIS |
@@ -43,15 +43,16 @@ For example: |
43 | 43 | .sp |
44 | 44 | pcre2grep some-pattern file1 - file3 |
45 | 45 | .sp |
46 | | -By default, input files are searched line by line. Each line that matches a |
47 | | -pattern is copied to the standard output, and if there is more than one file, |
48 | | -the file name is output at the start of each line, followed by a colon. |
49 | | -However, there are options that can change how \fBpcre2grep\fP behaves. For |
50 | | -example, the \fB-M\fP option makes it possible to search for strings that span |
51 | | -line boundaries. What defines a line boundary is controlled by the \fB-N\fP |
52 | | -(\fB--newline\fP) option. The \fB-h\fP and \fB-H\fP options control whether or |
53 | | -not file names are shown, and the \fB-Z\fP option changes the file name |
54 | | -terminator to a zero byte. |
| 46 | +By default, input files are searched line by line, so pattern assertions about |
| 47 | +the beginning and end of a subject string (^, $, \eA, \eZ, and \ez) match at |
| 48 | +the beginning and end of each line. When a line matches a pattern, it is copied |
| 49 | +to the standard output, and if there is more than one file, the file name is |
| 50 | +output at the start of each line, followed by a colon. However, there are |
| 51 | +options that can change how \fBpcre2grep\fP behaves. For example, the \fB-M\fP |
| 52 | +option makes it possible to search for strings that span line boundaries. What |
| 53 | +defines a line boundary is controlled by the \fB-N\fP (\fB--newline\fP) option. |
| 54 | +The \fB-h\fP and \fB-H\fP options control whether or not file names are shown, |
| 55 | +and the \fB-Z\fP option changes the file name terminator to a zero byte. |
55 | 56 | .P |
56 | 57 | The amount of memory used for buffering files that are being scanned is |
57 | 58 | controlled by parameters that can be set by the \fB--buffer-size\fP and |
@@ -489,16 +490,22 @@ used. There is no short form for this option. |
489 | 490 | .TP |
490 | 491 | \fB-M\fP, \fB--multiline\fP |
491 | 492 | Allow patterns to match more than one line. When this option is set, the PCRE2 |
492 | | -library is called in "multiline" mode. This allows a matched string to extend |
493 | | -past the end of a line and continue on one or more subsequent lines. Patterns |
494 | | -used with \fB-M\fP may usefully contain literal newline characters and internal |
495 | | -occurrences of ^ and $ characters. The output for a successful match may |
496 | | -consist of more than one line. The first line is the line in which the match |
497 | | -started, and the last line is the line in which the match ended. If the matched |
498 | | -string ends with a newline sequence, the output ends at the end of that line. |
499 | | -If \fB-v\fP is set, none of the lines in a multi-line match are output. Once a |
500 | | -match has been handled, scanning restarts at the beginning of the line after |
501 | | -the one in which the match ended. |
| 493 | +library is called in "multiline" mode, and a match is allowed to continue past |
| 494 | +the end of the initial line and onto one or more subsequent lines. |
| 495 | +.sp |
| 496 | +Patterns used with \fB-M\fP may usefully contain literal newline characters and |
| 497 | +internal occurrences of ^ and $ characters, because in multiline mode these can |
| 498 | +match at internal newlines. Because \fBpcre2grep\fP is scanning multiple lines, |
| 499 | +the \eZ and \ez assertions match only at the end of the last line in the file. |
| 500 | +The \eA assertion matches at the start of the first line of a match. This can |
| 501 | +be any line in the file; it is not anchored to the first line. |
| 502 | +.sp |
| 503 | +The output for a successful match may consist of more than one line. The first |
| 504 | +line is the line in which the match started, and the last line is the line in |
| 505 | +which the match ended. If the matched string ends with a newline sequence, the |
| 506 | +output ends at the end of that line. If \fB-v\fP is set, none of the lines in a |
| 507 | +multi-line match are output. Once a match has been handled, scanning restarts |
| 508 | +at the beginning of the line after the one in which the match ended. |
502 | 509 | .sp |
503 | 510 | The newline sequence that separates multiple lines must be matched as part of |
504 | 511 | the pattern. For example, to find the phrase "regular expression" in a file |
@@ -1006,6 +1013,6 @@ Cambridge, England. |
1006 | 1013 | .rs |
1007 | 1014 | .sp |
1008 | 1015 | .nf |
1009 | | -Last updated: 20 November 2023 |
| 1016 | +Last updated: 22 December 2023 |
1010 | 1017 | Copyright (c) 1997-2023 University of Cambridge. |
1011 | 1018 | .fi |
0 commit comments