summaryrefslogtreecommitdiff
path: root/src/regexp.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp.zig')
-rw-r--r--src/regexp.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/regexp.zig b/src/regexp.zig
index 7bcbceff..87fc51d6 100644
--- a/src/regexp.zig
+++ b/src/regexp.zig
@@ -595,6 +595,14 @@ test "a \\x without two hex digits is refused, not handed to mvzr to panic on" {
try std.testing.expectEqual(@as(usize, 1), (try rx.find("xA", 0, 1, 2)).?.start);
}
+test "a class's range may end at \\xff: UTF-8's high bytes as one class" {
+ var rx = try Regex.compile("[a-z\\x80-\\xff]+");
+ const text = "-- café --";
+ const m = (try rx.find(text, 0, text.len, text.len)).?;
+ try std.testing.expectEqualStrings("café", text[m.start..m.end]);
+ _ = try Regex.compile("[\\xff-\\xff]");
+}
+
test "a repeat inside a group gives back to what follows the group" {
const Case = struct { pat: []const u8, text: []const u8, start: usize, end: usize };
for ([_]Case{