summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmc <jmc@openbsd.org>2003-12-22 12:01:41 +0000
committerjmc <jmc@openbsd.org>2003-12-22 12:01:41 +0000
commit2f371dd00fd9896c386ab5de64cdb7f1401b1301 (patch)
treeaf3326eb7ca4d535d0ecea4180f8af44031f05f0
parentCorrectly handle vme attachments which specify a larger ca_len size than (diff)
downloadwireguard-openbsd-2f371dd00fd9896c386ab5de64cdb7f1401b1301.tar.xz
wireguard-openbsd-2f371dd00fd9896c386ab5de64cdb7f1401b1301.zip
document matching the empty string;
started by vax at carolina dot rr dot com (NetBSD PR 23810), resolved by jdolecek@netbsd (rev. 1.24); ok millert@
-rw-r--r--bin/expr/expr.118
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/expr/expr.1 b/bin/expr/expr.1
index a7581c8ba97..44635caefa2 100644
--- a/bin/expr/expr.1
+++ b/bin/expr/expr.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: expr.1,v 1.13 2003/03/12 20:12:35 deraadt Exp $
+.\" $OpenBSD: expr.1,v 1.14 2003/12/22 12:01:41 jmc Exp $
.\" $NetBSD: expr.1,v 1.9 1995/04/28 23:27:13 jtc Exp $
.\"
.\" Written by J.T. Conklin <jtc@netbsd.org>.
@@ -71,6 +71,22 @@ otherwise, the matching operator returns the number of characters matched.
If the match fails and the pattern contains a regular expression subexpression
the null string is returned;
otherwise, returns 0.
+.Pp
+Note: the empty string cannot be matched using
+.Bd -literal -offset indent
+expr '' : '$'
+.Ed
+.Pp
+This is because the returned number of matched characters
+.Pq zero
+is indistinguishable from a failed match, so
+.Nm
+returns failure
+.Pq 0 .
+To match the empty string, use a structure such as:
+.Bd -literal -offset indent
+expr X'' : 'X$'
+.Ed
.El
.Pp
Parentheses are used for grouping in the usual manner.