summaryrefslogtreecommitdiff
path: root/lib/regex/test/capture.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/regex/test/capture.myr')
-rw-r--r--lib/regex/test/capture.myr17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/regex/test/capture.myr b/lib/regex/test/capture.myr
new file mode 100644
index 0000000..f270428
--- /dev/null
+++ b/lib/regex/test/capture.myr
@@ -0,0 +1,17 @@
+use std
+use "testmatch.use"
+
+const main = {
+ testmatch("A(.*)", "Abc", `std.Some ["bc"][:])
+ testmatch("A(.*)e", "Abcde", `std.Some ["bcd"][:])
+ testmatch("(a|b)+", "abab", `std.Some ["b"][:])
+ testmatch("A(b(.*)d)e", "Abcde", `std.Some [
+ "bcd",
+ "c"
+ ][:])
+ testmatch("(a?)(a*)(a?)", "aaaa", `std.Some [
+ "a",
+ "aaa",
+ ""
+ ][:])
+}