summaryrefslogtreecommitdiff
path: root/doc/pcregrep.1
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-03-02 20:30:05 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2009-03-02 20:30:05 +0000
commit6cb9fd244262bb058af30cb11278b4d14cfe2d5c (patch)
tree000c3967096a8da982ee50c23a22b54cb6683253 /doc/pcregrep.1
parent3893b93c01b7deb23b0d566224c595de0cc27188 (diff)
downloadpcre-6cb9fd244262bb058af30cb11278b4d14cfe2d5c.tar.gz
Lock out empty string matches in pcregrep.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@379 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'doc/pcregrep.1')
-rw-r--r--doc/pcregrep.131
1 files changed, 21 insertions, 10 deletions
diff --git a/doc/pcregrep.1 b/doc/pcregrep.1
index ed24df2..cae383d 100644
--- a/doc/pcregrep.1
+++ b/doc/pcregrep.1
@@ -25,7 +25,7 @@ If you attempt to use delimiters (for example, by surrounding a pattern with
slashes, as is common in Perl scripts), they are interpreted as part of the
pattern. Quotes can of course be used to delimit patterns on the command line
because they are interpreted by the shell, and indeed they are required if a
-pattern contains white space or shell metacharacters.
+pattern contains white space or shell metacharacters.
.P
The first argument that follows any option settings is treated as the single
pattern to be matched when neither \fB-e\fP nor \fB-f\fP is present.
@@ -50,16 +50,27 @@ Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to
each line in the order in which they are defined, except that all the \fB-e\fP
-patterns are tried before the \fB-f\fP patterns. As soon as one pattern matches
-(or fails to match when \fB-v\fP is used), no further patterns are considered.
+patterns are tried before the \fB-f\fP patterns.
.P
-When \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP
-is used, the output is the part of the line that matched (either shown
-literally, or as an offset). In this case, scanning resumes immediately
-following the match, so that further matches on the same line can be found.
-If there are multiple patterns, they are all tried on the remainder of the
-line. However, patterns that follow the one that matched are not tried on the
-earlier part of the line.
+By default, as soon as one pattern matches (or fails to match when \fB-v\fP is
+used), no further patterns are considered. However, if \fB--colour\fP (or
+\fB--color\fP) is used to colour the matching substrings, or if
+\fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP is used to
+output only the part of the line that matched (either shown literally, or as an
+offset), scanning resumes immediately following the match, so that further
+matches on the same line can be found. If there are multiple patterns, they are
+all tried on the remainder of the line, but patterns that follow the one that
+matched are not tried on the earlier part of the line.
+.P
+This is the same behaviour as GNU grep, but it does mean that the order in
+which multiple patterns are specified can affect the output when one of the
+above options is used.
+.P
+Patterns that can match an empty string are accepted, but empty string
+matches are not recognized. An example is the pattern "(super)?(man)?", in
+which all components are optional. This pattern finds all occurrences of both
+"super" and "man"; the output differs from matching with "super|man" when only
+the matching substrings are being shown.
.P
If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set,
\fBpcregrep\fP uses the value to set a locale when calling the PCRE library.