From 7c329baddb0d45ce7937cf29941dde861f9ea27f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 11:50:52 -0300 Subject: A pattern anchoring some alternatives with ^ and not others is refused with why, not a bare bad regular expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `^def|x` and `foo$|^zèbre` were refused with a bare "bad regular expression", the same words as a syntax error, so a script could not tell what to change. They now say "an alternation anchors every branch with ^ or none (^a|^b, not ^a|b)", through addr and Edit alike. fs.md states the rule and that a `$` does not count toward it (`foo$|bar` is fine). Co-Authored-By: Claude Opus 5.5 --- src/sam_edit.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sam_edit.zig') diff --git a/src/sam_edit.zig b/src/sam_edit.zig index 0f317a83..94cf6fe0 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -463,6 +463,7 @@ const Exec = struct { error.TooLong => fail(ex.why, "{s}", .{regexp.Regex.e_long}), error.WideRange => fail(ex.why, "{s}", .{regexp.Regex.e_wide}), error.NegatedRunes => fail(ex.why, "{s}", .{regexp.Regex.e_negated}), + error.Mixed => fail(ex.why, "{s}", .{regexp.Regex.e_mixed}), error.Bad => fail(ex.why, "bad regexp in {c} command", .{c}), }; } -- cgit v1.3