version 1.24, 2003/12/21 10:02:46 |
version 1.25, 2003/12/21 11:18:25 |
|
|
.An Jaromir Dolecek |
.An Jaromir Dolecek |
.Aq jdolecek@NetBSD.org . |
.Aq jdolecek@NetBSD.org . |
.Sh NOTES |
.Sh NOTES |
Empty string |
The empty string |
.Dq |
.Dq |
cannot be matched with intuitive: |
cannot be matched with the intuitive: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
expr '' : '$' |
expr '' : '$' |
.Ed |
.Ed |
.Pp |
.Pp |
The reason is the returned number of matched characters (zero) |
The reason is that the returned number of matched characters (zero) |
is indistinguishable from failed match, so this returns failure. |
is indistinguishable from a failed match, so this returns failure. |
To match empty string, use something like: |
To match the empty string, use something like: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
expr x'' : 'x$' |
expr x'' : 'x$' |
.Ed |
.Ed |