diff options
-rw-r--r-- | man/grab.1 | 4 | ||||
-rw-r--r-- | src/grab.c | 2 |
2 files changed, 6 insertions, 0 deletions
@@ -234,6 +234,10 @@ letter, and highlights the capital letter(s): .Pp .Dl x/\ew+/ g/[A\-Z]/ h// +.Pp +The empty +.Sq h +operator is not permitted as the first operator in a pattern. .Sh ENVIRONMENT .Bl -tag -width GRAB_COLORS .It Ev GRAB_COLORS @@ -302,6 +302,8 @@ comppat(char8_t *s) if (s - p == 0) { if (op.c != 'h') diex("Empty regex given to ‘%c’", op.c); + if (ops.len == 0) + diex("Empty ‘h’ is not allowed as the first operator"); op.pat = ops.buf[ops.len - 1].pat; } else op.pat = mkregex(p, s - p); |