diff --git a/README.md b/README.md index b3be9da..2ee6143 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Based on the classfication within the [MDN cheatsheet](https://developer.mozilla - [x] global - [ ] sticky - [x] case insensitive -- [ ] multiline +- [x] multiline - [x] dotAll - [ ] unicode diff --git a/assembly/__spec_tests__/generated.spec.ts b/assembly/__spec_tests__/generated.spec.ts index 0989a34..f535a5c 100644 --- a/assembly/__spec_tests__/generated.spec.ts +++ b/assembly/__spec_tests__/generated.spec.ts @@ -5,7 +5,7 @@ import { RegExp, Match } from ".."; import { expectMatch, expectNotMatch, exec } from "../__tests__/utils"; it("line: 1 - matches the quick brown fox against 'the quick brown fox'", () => { - const match = exec("the quick brown fox", "the quick brown fox", "s"); + const match = exec("the quick brown fox", "the quick brown fox", "ms"); expect(match.matches[0]).toBe("the quick brown fox".substring(0, 19)); }); it("line: 2 - matches the quick brown fox against 'The quick brown FOX'", () => { @@ -15,7 +15,7 @@ it("line: 3 - matches the quick brown fox against 'What do you know about the qu const match = exec( "the quick brown fox", "What do you know about the quick brown fox?", - "s" + "ms" ); expect(match.matches[0]).toBe( "What do you know about the quick brown fox?".substring(23, 42) @@ -27,18 +27,18 @@ it("line: 4 - matches the quick brown fox against 'What do you know about THE QU ]); }); it("line: 5 - matches The quick brown fox against 'the quick brown fox'", () => { - const match = exec("The quick brown fox", "the quick brown fox", "is"); + const match = exec("The quick brown fox", "the quick brown fox", "mis"); expect(match.matches[0]).toBe("the quick brown fox".substring(0, 19)); }); it("line: 6 - matches The quick brown fox against 'The quick brown FOX'", () => { - const match = exec("The quick brown fox", "The quick brown FOX", "is"); + const match = exec("The quick brown fox", "The quick brown FOX", "mis"); expect(match.matches[0]).toBe("The quick brown FOX".substring(0, 19)); }); it("line: 7 - matches The quick brown fox against 'What do you know about the quick brown fox?'", () => { const match = exec( "The quick brown fox", "What do you know about the quick brown fox?", - "is" + "mis" ); expect(match.matches[0]).toBe( "What do you know about the quick brown fox?".substring(23, 42) @@ -48,7 +48,7 @@ it("line: 8 - matches The quick brown fox against 'What do you know about THE QU const match = exec( "The quick brown fox", "What do you know about THE QUICK BROWN FOX?", - "is" + "mis" ); expect(match.matches[0]).toBe( "What do you know about THE QUICK BROWN FOX?".substring(23, 42) @@ -59,7 +59,7 @@ it("line: 10 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'abx const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "abxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("abxyzpqrrrabbxyyyypqAzz".substring(0, 23)); }); @@ -67,7 +67,7 @@ it("line: 11 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'abx const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "abxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("abxyzpqrrrabbxyyyypqAzz".substring(0, 23)); }); @@ -75,7 +75,7 @@ it("line: 12 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aab const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aabxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aabxyzpqrrrabbxyyyypqAzz".substring(0, 24)); }); @@ -83,7 +83,7 @@ it("line: 13 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabxyzpqrrrabbxyyyypqAzz".substring(0, 25)); }); @@ -91,7 +91,7 @@ it("line: 14 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaaabxyzpqrrrabbxyyyypqAzz".substring(0, 26)); }); @@ -99,7 +99,7 @@ it("line: 15 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'abc const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "abcxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("abcxyzpqrrrabbxyyyypqAzz".substring(0, 24)); }); @@ -107,7 +107,7 @@ it("line: 16 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aab const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aabcxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aabcxyzpqrrrabbxyyyypqAzz".substring(0, 25)); }); @@ -115,7 +115,7 @@ it("line: 17 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabcxyzpqrrrabbxyyyypAzz".substring(0, 25)); }); @@ -123,7 +123,7 @@ it("line: 18 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabcxyzpqrrrabbxyyyypqAzz".substring(0, 26)); }); @@ -131,7 +131,7 @@ it("line: 19 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabcxyzpqrrrabbxyyyypqqAzz".substring(0, 27)); }); @@ -139,7 +139,7 @@ it("line: 20 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqqqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabcxyzpqrrrabbxyyyypqqqAzz".substring(0, 28) @@ -149,7 +149,7 @@ it("line: 21 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqqqqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabcxyzpqrrrabbxyyyypqqqqAzz".substring(0, 29) @@ -159,7 +159,7 @@ it("line: 22 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqqqqqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabcxyzpqrrrabbxyyyypqqqqqAzz".substring(0, 30) @@ -169,7 +169,7 @@ it("line: 23 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypqqqqqqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabcxyzpqrrrabbxyyyypqqqqqqAzz".substring(0, 31) @@ -179,7 +179,7 @@ it("line: 24 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabcxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaaabcxyzpqrrrabbxyyyypqAzz".substring(0, 27)); }); @@ -187,7 +187,7 @@ it("line: 25 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'abx const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "abxyzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("abxyzzpqrrrabbxyyyypqAzz".substring(0, 24)); }); @@ -195,7 +195,7 @@ it("line: 26 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aab const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aabxyzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aabxyzzzpqrrrabbxyyyypqAzz".substring(0, 26)); }); @@ -203,7 +203,7 @@ it("line: 27 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabxyzzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabxyzzzzpqrrrabbxyyyypqAzz".substring(0, 28) @@ -213,7 +213,7 @@ it("line: 28 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabxyzzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaaabxyzzzzpqrrrabbxyyyypqAzz".substring(0, 29) @@ -223,7 +223,7 @@ it("line: 29 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'abc const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "abcxyzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("abcxyzzpqrrrabbxyyyypqAzz".substring(0, 25)); }); @@ -231,7 +231,7 @@ it("line: 30 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aab const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aabcxyzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aabcxyzzzpqrrrabbxyyyypqAzz".substring(0, 27)); }); @@ -239,7 +239,7 @@ it("line: 31 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaabcxyzzzzpqrrrabbxyyyypqAzz".substring(0, 29) @@ -249,7 +249,7 @@ it("line: 32 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabcxyzzzzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaaabcxyzzzzpqrrrabbxyyyypqAzz".substring(0, 30) @@ -259,7 +259,7 @@ it("line: 33 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabcxyzzzzpqrrrabbbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaaabcxyzzzzpqrrrabbbxyyyypqAzz".substring(0, 31) @@ -269,7 +269,7 @@ it("line: 34 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaaabcxyzzzzpqrrrabbbxyyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( "aaaabcxyzzzzpqrrrabbbxyyyyypqAzz".substring(0, 32) @@ -279,7 +279,7 @@ it("line: 35 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypABzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabcxyzpqrrrabbxyyyypABzz".substring(0, 26)); }); @@ -287,7 +287,7 @@ it("line: 36 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", "aaabcxyzpqrrrabbxyyyypABBzz", - "s" + "ms" ); expect(match.matches[0]).toBe("aaabcxyzpqrrrabbxyyyypABBzz".substring(0, 27)); }); @@ -295,7 +295,7 @@ it("line: 37 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against '>>> const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", ">>>aaabxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( ">>>aaabxyzpqrrrabbxyyyypqAzz".substring(3, 28) @@ -305,7 +305,7 @@ it("line: 38 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against '>aa const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", ">aaaabxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe(">aaaabxyzpqrrrabbxyyyypqAzz".substring(1, 27)); }); @@ -313,7 +313,7 @@ it("line: 39 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against '>>> const match = exec( "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", ">>>>abcxyzpqrrrabbxyyyypqAzz", - "s" + "ms" ); expect(match.matches[0]).toBe( ">>>>abcxyzpqrrrabbxyyyypqAzz".substring(4, 28) @@ -350,12 +350,12 @@ it("line: 45 - matches a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz against 'aaa ]); }); it("line: 46 - matches ^(abc){1,2}zz against 'abczz'", () => { - const match = exec("^(abc){1,2}zz", "abczz", "s"); + const match = exec("^(abc){1,2}zz", "abczz", "ms"); expect(match.matches[0]).toBe("abczz".substring(0, 5)); expect(match.matches[1]).toBe("abczz".substring(0, 3)); }); it("line: 47 - matches ^(abc){1,2}zz against 'abcabczz'", () => { - const match = exec("^(abc){1,2}zz", "abcabczz", "s"); + const match = exec("^(abc){1,2}zz", "abcabczz", "ms"); expect(match.matches[0]).toBe("abcabczz".substring(0, 8)); expect(match.matches[1]).toBe("abcabczz".substring(3, 6)); }); @@ -369,42 +369,42 @@ it("line: 50 - matches ^(abc){1,2}zz against '>>abczz'", () => { expectNotMatch("^(abc){1,2}zz", [">>abczz"]); }); it("line: 51 - matches ^(b+?|a){1,2}?c against 'bc'", () => { - const match = exec("^(b+?|a){1,2}?c", "bc", "s"); + const match = exec("^(b+?|a){1,2}?c", "bc", "ms"); expect(match.matches[0]).toBe("bc".substring(0, 2)); expect(match.matches[1]).toBe("bc".substring(0, 1)); }); it("line: 52 - matches ^(b+?|a){1,2}?c against 'bbc'", () => { - const match = exec("^(b+?|a){1,2}?c", "bbc", "s"); + const match = exec("^(b+?|a){1,2}?c", "bbc", "ms"); expect(match.matches[0]).toBe("bbc".substring(0, 3)); expect(match.matches[1]).toBe("bbc".substring(1, 2)); }); it("line: 53 - matches ^(b+?|a){1,2}?c against 'bbbc'", () => { - const match = exec("^(b+?|a){1,2}?c", "bbbc", "s"); + const match = exec("^(b+?|a){1,2}?c", "bbbc", "ms"); expect(match.matches[0]).toBe("bbbc".substring(0, 4)); expect(match.matches[1]).toBe("bbbc".substring(1, 3)); }); it("line: 54 - matches ^(b+?|a){1,2}?c against 'bac'", () => { - const match = exec("^(b+?|a){1,2}?c", "bac", "s"); + const match = exec("^(b+?|a){1,2}?c", "bac", "ms"); expect(match.matches[0]).toBe("bac".substring(0, 3)); expect(match.matches[1]).toBe("bac".substring(1, 2)); }); it("line: 55 - matches ^(b+?|a){1,2}?c against 'bbac'", () => { - const match = exec("^(b+?|a){1,2}?c", "bbac", "s"); + const match = exec("^(b+?|a){1,2}?c", "bbac", "ms"); expect(match.matches[0]).toBe("bbac".substring(0, 4)); expect(match.matches[1]).toBe("bbac".substring(2, 3)); }); it("line: 56 - matches ^(b+?|a){1,2}?c against 'aac'", () => { - const match = exec("^(b+?|a){1,2}?c", "aac", "s"); + const match = exec("^(b+?|a){1,2}?c", "aac", "ms"); expect(match.matches[0]).toBe("aac".substring(0, 3)); expect(match.matches[1]).toBe("aac".substring(1, 2)); }); it("line: 57 - matches ^(b+?|a){1,2}?c against 'abbbbbbbbbbbc'", () => { - const match = exec("^(b+?|a){1,2}?c", "abbbbbbbbbbbc", "s"); + const match = exec("^(b+?|a){1,2}?c", "abbbbbbbbbbbc", "ms"); expect(match.matches[0]).toBe("abbbbbbbbbbbc".substring(0, 13)); expect(match.matches[1]).toBe("abbbbbbbbbbbc".substring(1, 12)); }); it("line: 58 - matches ^(b+?|a){1,2}?c against 'bbbbbbbbbbbac'", () => { - const match = exec("^(b+?|a){1,2}?c", "bbbbbbbbbbbac", "s"); + const match = exec("^(b+?|a){1,2}?c", "bbbbbbbbbbbac", "ms"); expect(match.matches[0]).toBe("bbbbbbbbbbbac".substring(0, 13)); expect(match.matches[1]).toBe("bbbbbbbbbbbac".substring(11, 12)); }); @@ -415,42 +415,42 @@ it("line: 60 - matches ^(b+?|a){1,2}?c against 'abbbbbbbbbbbac'", () => { expectNotMatch("^(b+?|a){1,2}?c", ["abbbbbbbbbbbac"]); }); it("line: 61 - matches ^(b+|a){1,2}c against 'bc'", () => { - const match = exec("^(b+|a){1,2}c", "bc", "s"); + const match = exec("^(b+|a){1,2}c", "bc", "ms"); expect(match.matches[0]).toBe("bc".substring(0, 2)); expect(match.matches[1]).toBe("bc".substring(0, 1)); }); it("line: 62 - matches ^(b+|a){1,2}c against 'bbc'", () => { - const match = exec("^(b+|a){1,2}c", "bbc", "s"); + const match = exec("^(b+|a){1,2}c", "bbc", "ms"); expect(match.matches[0]).toBe("bbc".substring(0, 3)); expect(match.matches[1]).toBe("bbc".substring(0, 2)); }); it("line: 63 - matches ^(b+|a){1,2}c against 'bbbc'", () => { - const match = exec("^(b+|a){1,2}c", "bbbc", "s"); + const match = exec("^(b+|a){1,2}c", "bbbc", "ms"); expect(match.matches[0]).toBe("bbbc".substring(0, 4)); expect(match.matches[1]).toBe("bbbc".substring(0, 3)); }); it("line: 64 - matches ^(b+|a){1,2}c against 'bac'", () => { - const match = exec("^(b+|a){1,2}c", "bac", "s"); + const match = exec("^(b+|a){1,2}c", "bac", "ms"); expect(match.matches[0]).toBe("bac".substring(0, 3)); expect(match.matches[1]).toBe("bac".substring(1, 2)); }); it("line: 65 - matches ^(b+|a){1,2}c against 'bbac'", () => { - const match = exec("^(b+|a){1,2}c", "bbac", "s"); + const match = exec("^(b+|a){1,2}c", "bbac", "ms"); expect(match.matches[0]).toBe("bbac".substring(0, 4)); expect(match.matches[1]).toBe("bbac".substring(2, 3)); }); it("line: 66 - matches ^(b+|a){1,2}c against 'aac'", () => { - const match = exec("^(b+|a){1,2}c", "aac", "s"); + const match = exec("^(b+|a){1,2}c", "aac", "ms"); expect(match.matches[0]).toBe("aac".substring(0, 3)); expect(match.matches[1]).toBe("aac".substring(1, 2)); }); it("line: 67 - matches ^(b+|a){1,2}c against 'abbbbbbbbbbbc'", () => { - const match = exec("^(b+|a){1,2}c", "abbbbbbbbbbbc", "s"); + const match = exec("^(b+|a){1,2}c", "abbbbbbbbbbbc", "ms"); expect(match.matches[0]).toBe("abbbbbbbbbbbc".substring(0, 13)); expect(match.matches[1]).toBe("abbbbbbbbbbbc".substring(1, 12)); }); it("line: 68 - matches ^(b+|a){1,2}c against 'bbbbbbbbbbbac'", () => { - const match = exec("^(b+|a){1,2}c", "bbbbbbbbbbbac", "s"); + const match = exec("^(b+|a){1,2}c", "bbbbbbbbbbbac", "ms"); expect(match.matches[0]).toBe("bbbbbbbbbbbac".substring(0, 13)); expect(match.matches[1]).toBe("bbbbbbbbbbbac".substring(11, 12)); }); @@ -461,22 +461,22 @@ it("line: 70 - matches ^(b+|a){1,2}c against 'abbbbbbbbbbbac'", () => { expectNotMatch("^(b+|a){1,2}c", ["abbbbbbbbbbbac"]); }); it("line: 71 - matches ^(b+|a){1,2}?bc against 'bbc'", () => { - const match = exec("^(b+|a){1,2}?bc", "bbc", "s"); + const match = exec("^(b+|a){1,2}?bc", "bbc", "ms"); expect(match.matches[0]).toBe("bbc".substring(0, 3)); expect(match.matches[1]).toBe("bbc".substring(0, 1)); }); it("line: 72 - matches ^(b*|ba){1,2}?bc against 'babc'", () => { - const match = exec("^(b*|ba){1,2}?bc", "babc", "s"); + const match = exec("^(b*|ba){1,2}?bc", "babc", "ms"); expect(match.matches[0]).toBe("babc".substring(0, 4)); expect(match.matches[1]).toBe("babc".substring(0, 2)); }); it("line: 73 - matches ^(b*|ba){1,2}?bc against 'bbabc'", () => { - const match = exec("^(b*|ba){1,2}?bc", "bbabc", "s"); + const match = exec("^(b*|ba){1,2}?bc", "bbabc", "ms"); expect(match.matches[0]).toBe("bbabc".substring(0, 5)); expect(match.matches[1]).toBe("bbabc".substring(1, 3)); }); it("line: 74 - matches ^(b*|ba){1,2}?bc against 'bababc'", () => { - const match = exec("^(b*|ba){1,2}?bc", "bababc", "s"); + const match = exec("^(b*|ba){1,2}?bc", "bababc", "ms"); expect(match.matches[0]).toBe("bababc".substring(0, 6)); expect(match.matches[1]).toBe("bababc".substring(2, 4)); }); @@ -487,17 +487,17 @@ it("line: 76 - matches ^(b*|ba){1,2}?bc against 'babababc'", () => { expectNotMatch("^(b*|ba){1,2}?bc", ["babababc"]); }); it("line: 77 - matches ^(ba|b*){1,2}?bc against 'babc'", () => { - const match = exec("^(ba|b*){1,2}?bc", "babc", "s"); + const match = exec("^(ba|b*){1,2}?bc", "babc", "ms"); expect(match.matches[0]).toBe("babc".substring(0, 4)); expect(match.matches[1]).toBe("babc".substring(0, 2)); }); it("line: 78 - matches ^(ba|b*){1,2}?bc against 'bbabc'", () => { - const match = exec("^(ba|b*){1,2}?bc", "bbabc", "s"); + const match = exec("^(ba|b*){1,2}?bc", "bbabc", "ms"); expect(match.matches[0]).toBe("bbabc".substring(0, 5)); expect(match.matches[1]).toBe("bbabc".substring(1, 3)); }); it("line: 79 - matches ^(ba|b*){1,2}?bc against 'bababc'", () => { - const match = exec("^(ba|b*){1,2}?bc", "bababc", "s"); + const match = exec("^(ba|b*){1,2}?bc", "bababc", "ms"); expect(match.matches[0]).toBe("bababc".substring(0, 6)); expect(match.matches[1]).toBe("bababc".substring(2, 4)); }); @@ -509,27 +509,27 @@ it("line: 81 - matches ^(ba|b*){1,2}?bc against 'babababc'", () => { }); xit("line: 82 - test regex contains syntax not supported in JS", () => {}); it("line: 83 - matches ^[ab\\]cde] against 'athing'", () => { - const match = exec("^[ab\\]cde]", "athing", "s"); + const match = exec("^[ab\\]cde]", "athing", "ms"); expect(match.matches[0]).toBe("athing".substring(0, 1)); }); it("line: 84 - matches ^[ab\\]cde] against 'bthing'", () => { - const match = exec("^[ab\\]cde]", "bthing", "s"); + const match = exec("^[ab\\]cde]", "bthing", "ms"); expect(match.matches[0]).toBe("bthing".substring(0, 1)); }); it("line: 85 - matches ^[ab\\]cde] against ']thing'", () => { - const match = exec("^[ab\\]cde]", "]thing", "s"); + const match = exec("^[ab\\]cde]", "]thing", "ms"); expect(match.matches[0]).toBe("]thing".substring(0, 1)); }); it("line: 86 - matches ^[ab\\]cde] against 'cthing'", () => { - const match = exec("^[ab\\]cde]", "cthing", "s"); + const match = exec("^[ab\\]cde]", "cthing", "ms"); expect(match.matches[0]).toBe("cthing".substring(0, 1)); }); it("line: 87 - matches ^[ab\\]cde] against 'dthing'", () => { - const match = exec("^[ab\\]cde]", "dthing", "s"); + const match = exec("^[ab\\]cde]", "dthing", "ms"); expect(match.matches[0]).toBe("dthing".substring(0, 1)); }); it("line: 88 - matches ^[ab\\]cde] against 'ething'", () => { - const match = exec("^[ab\\]cde]", "ething", "s"); + const match = exec("^[ab\\]cde]", "ething", "ms"); expect(match.matches[0]).toBe("ething".substring(0, 1)); }); it("line: 89 - matches ^[ab\\]cde] against 'fthing'", () => { @@ -542,19 +542,19 @@ it("line: 91 - matches ^[ab\\]cde] against '\\thing'", () => { expectNotMatch("^[ab\\]cde]", ["\\thing"]); }); it("line: 92 - matches ^[]cde] against ']thing'", () => { - const match = exec("^[]cde]", "]thing", "s"); + const match = exec("^[]cde]", "]thing", "ms"); expect(match.matches[0]).toBe("]thing".substring(0, 1)); }); it("line: 93 - matches ^[]cde] against 'cthing'", () => { - const match = exec("^[]cde]", "cthing", "s"); + const match = exec("^[]cde]", "cthing", "ms"); expect(match.matches[0]).toBe("cthing".substring(0, 1)); }); it("line: 94 - matches ^[]cde] against 'dthing'", () => { - const match = exec("^[]cde]", "dthing", "s"); + const match = exec("^[]cde]", "dthing", "ms"); expect(match.matches[0]).toBe("dthing".substring(0, 1)); }); it("line: 95 - matches ^[]cde] against 'ething'", () => { - const match = exec("^[]cde]", "ething", "s"); + const match = exec("^[]cde]", "ething", "ms"); expect(match.matches[0]).toBe("ething".substring(0, 1)); }); it("line: 96 - matches ^[]cde] against 'athing'", () => { @@ -564,15 +564,15 @@ it("line: 97 - matches ^[]cde] against 'fthing'", () => { expectNotMatch("^[]cde]", ["fthing"]); }); it("line: 98 - matches ^[^ab\\]cde] against 'fthing'", () => { - const match = exec("^[^ab\\]cde]", "fthing", "s"); + const match = exec("^[^ab\\]cde]", "fthing", "ms"); expect(match.matches[0]).toBe("fthing".substring(0, 1)); }); it("line: 99 - matches ^[^ab\\]cde] against '[thing'", () => { - const match = exec("^[^ab\\]cde]", "[thing", "s"); + const match = exec("^[^ab\\]cde]", "[thing", "ms"); expect(match.matches[0]).toBe("[thing".substring(0, 1)); }); it("line: 100 - matches ^[^ab\\]cde] against '\\thing'", () => { - const match = exec("^[^ab\\]cde]", "\\thing", "s"); + const match = exec("^[^ab\\]cde]", "\\thing", "ms"); expect(match.matches[0]).toBe("\\thing".substring(0, 1)); }); it("line: 101 - matches ^[^ab\\]cde] against 'athing'", () => { @@ -594,11 +594,11 @@ it("line: 106 - matches ^[^ab\\]cde] against 'ething'", () => { expectNotMatch("^[^ab\\]cde]", ["ething"]); }); it("line: 107 - matches ^[^]cde] against 'athing'", () => { - const match = exec("^[^]cde]", "athing", "s"); + const match = exec("^[^]cde]", "athing", "ms"); expect(match.matches[0]).toBe("athing".substring(0, 1)); }); it("line: 108 - matches ^[^]cde] against 'fthing'", () => { - const match = exec("^[^]cde]", "fthing", "s"); + const match = exec("^[^]cde]", "fthing", "ms"); expect(match.matches[0]).toBe("fthing".substring(0, 1)); }); it("line: 109 - matches ^[^]cde] against ']thing'", () => { @@ -614,112 +614,112 @@ it("line: 112 - matches ^[^]cde] against 'ething'", () => { expectNotMatch("^[^]cde]", ["ething"]); }); it("line: 113 - matches ^\\� against '�'", () => { - const match = exec("^\\�", "�", "s"); + const match = exec("^\\�", "�", "ms"); expect(match.matches[0]).toBe("�".substring(0, 1)); }); it("line: 114 - matches ^� against '�'", () => { - const match = exec("^�", "�", "s"); + const match = exec("^�", "�", "ms"); expect(match.matches[0]).toBe("�".substring(0, 1)); }); it("line: 115 - matches ^[0-9]+$ against '0'", () => { - const match = exec("^[0-9]+$", "0", "s"); + const match = exec("^[0-9]+$", "0", "ms"); expect(match.matches[0]).toBe("0".substring(0, 1)); }); it("line: 116 - matches ^[0-9]+$ against '1'", () => { - const match = exec("^[0-9]+$", "1", "s"); + const match = exec("^[0-9]+$", "1", "ms"); expect(match.matches[0]).toBe("1".substring(0, 1)); }); it("line: 117 - matches ^[0-9]+$ against '2'", () => { - const match = exec("^[0-9]+$", "2", "s"); + const match = exec("^[0-9]+$", "2", "ms"); expect(match.matches[0]).toBe("2".substring(0, 1)); }); it("line: 118 - matches ^[0-9]+$ against '3'", () => { - const match = exec("^[0-9]+$", "3", "s"); + const match = exec("^[0-9]+$", "3", "ms"); expect(match.matches[0]).toBe("3".substring(0, 1)); }); it("line: 119 - matches ^[0-9]+$ against '4'", () => { - const match = exec("^[0-9]+$", "4", "s"); + const match = exec("^[0-9]+$", "4", "ms"); expect(match.matches[0]).toBe("4".substring(0, 1)); }); it("line: 120 - matches ^[0-9]+$ against '5'", () => { - const match = exec("^[0-9]+$", "5", "s"); + const match = exec("^[0-9]+$", "5", "ms"); expect(match.matches[0]).toBe("5".substring(0, 1)); }); it("line: 121 - matches ^[0-9]+$ against '6'", () => { - const match = exec("^[0-9]+$", "6", "s"); + const match = exec("^[0-9]+$", "6", "ms"); expect(match.matches[0]).toBe("6".substring(0, 1)); }); it("line: 122 - matches ^[0-9]+$ against '7'", () => { - const match = exec("^[0-9]+$", "7", "s"); + const match = exec("^[0-9]+$", "7", "ms"); expect(match.matches[0]).toBe("7".substring(0, 1)); }); it("line: 123 - matches ^[0-9]+$ against '8'", () => { - const match = exec("^[0-9]+$", "8", "s"); + const match = exec("^[0-9]+$", "8", "ms"); expect(match.matches[0]).toBe("8".substring(0, 1)); }); it("line: 124 - matches ^[0-9]+$ against '9'", () => { - const match = exec("^[0-9]+$", "9", "s"); + const match = exec("^[0-9]+$", "9", "ms"); expect(match.matches[0]).toBe("9".substring(0, 1)); }); it("line: 125 - matches ^[0-9]+$ against '10'", () => { - const match = exec("^[0-9]+$", "10", "s"); + const match = exec("^[0-9]+$", "10", "ms"); expect(match.matches[0]).toBe("10".substring(0, 2)); }); it("line: 126 - matches ^[0-9]+$ against '100'", () => { - const match = exec("^[0-9]+$", "100", "s"); + const match = exec("^[0-9]+$", "100", "ms"); expect(match.matches[0]).toBe("100".substring(0, 3)); }); it("line: 127 - matches ^[0-9]+$ against 'abc'", () => { expectNotMatch("^[0-9]+$", ["abc"]); }); it("line: 128 - matches ^.*nter against 'enter'", () => { - const match = exec("^.*nter", "enter", "s"); + const match = exec("^.*nter", "enter", "ms"); expect(match.matches[0]).toBe("enter".substring(0, 5)); }); it("line: 129 - matches ^.*nter against 'inter'", () => { - const match = exec("^.*nter", "inter", "s"); + const match = exec("^.*nter", "inter", "ms"); expect(match.matches[0]).toBe("inter".substring(0, 5)); }); it("line: 130 - matches ^.*nter against 'uponter'", () => { - const match = exec("^.*nter", "uponter", "s"); + const match = exec("^.*nter", "uponter", "ms"); expect(match.matches[0]).toBe("uponter".substring(0, 7)); }); it("line: 131 - matches ^xxx[0-9]+$ against 'xxx0'", () => { - const match = exec("^xxx[0-9]+$", "xxx0", "s"); + const match = exec("^xxx[0-9]+$", "xxx0", "ms"); expect(match.matches[0]).toBe("xxx0".substring(0, 4)); }); it("line: 132 - matches ^xxx[0-9]+$ against 'xxx1234'", () => { - const match = exec("^xxx[0-9]+$", "xxx1234", "s"); + const match = exec("^xxx[0-9]+$", "xxx1234", "ms"); expect(match.matches[0]).toBe("xxx1234".substring(0, 7)); }); it("line: 133 - matches ^xxx[0-9]+$ against 'xxx'", () => { expectNotMatch("^xxx[0-9]+$", ["xxx"]); }); it("line: 134 - matches ^.+[0-9][0-9][0-9]$ against 'x123'", () => { - const match = exec("^.+[0-9][0-9][0-9]$", "x123", "s"); + const match = exec("^.+[0-9][0-9][0-9]$", "x123", "ms"); expect(match.matches[0]).toBe("x123".substring(0, 4)); }); it("line: 135 - matches ^.+[0-9][0-9][0-9]$ against 'xx123'", () => { - const match = exec("^.+[0-9][0-9][0-9]$", "xx123", "s"); + const match = exec("^.+[0-9][0-9][0-9]$", "xx123", "ms"); expect(match.matches[0]).toBe("xx123".substring(0, 5)); }); it("line: 136 - matches ^.+[0-9][0-9][0-9]$ against '123456'", () => { - const match = exec("^.+[0-9][0-9][0-9]$", "123456", "s"); + const match = exec("^.+[0-9][0-9][0-9]$", "123456", "ms"); expect(match.matches[0]).toBe("123456".substring(0, 6)); }); it("line: 137 - matches ^.+[0-9][0-9][0-9]$ against '123'", () => { expectNotMatch("^.+[0-9][0-9][0-9]$", ["123"]); }); it("line: 138 - matches ^.+[0-9][0-9][0-9]$ against 'x1234'", () => { - const match = exec("^.+[0-9][0-9][0-9]$", "x1234", "s"); + const match = exec("^.+[0-9][0-9][0-9]$", "x1234", "ms"); expect(match.matches[0]).toBe("x1234".substring(0, 5)); }); it("line: 139 - matches ^.+?[0-9][0-9][0-9]$ against 'x123'", () => { - const match = exec("^.+?[0-9][0-9][0-9]$", "x123", "s"); + const match = exec("^.+?[0-9][0-9][0-9]$", "x123", "ms"); expect(match.matches[0]).toBe("x123".substring(0, 4)); }); it("line: 140 - matches ^.+?[0-9][0-9][0-9]$ against 'xx123'", () => { - const match = exec("^.+?[0-9][0-9][0-9]$", "xx123", "s"); + const match = exec("^.+?[0-9][0-9][0-9]$", "xx123", "ms"); expect(match.matches[0]).toBe("xx123".substring(0, 5)); }); xit("line: 141 - lazy quantifiers should still yield the longest overall regex match", () => {}); @@ -729,7 +729,7 @@ it("line: 144 - matches ^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$ against 'abc const match = exec( "^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$", "abc!pqr=apquxz.ixr.zzz.ac.uk", - "s" + "ms" ); expect(match.matches[0]).toBe( "abc!pqr=apquxz.ixr.zzz.ac.uk".substring(0, 28) @@ -758,7 +758,7 @@ it("line: 148 - matches ^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$ against 'abc ]); }); it("line: 149 - matches : against 'Well, we need a colon: somewhere'", () => { - const match = exec(":", "Well, we need a colon: somewhere", "s"); + const match = exec(":", "Well, we need a colon: somewhere", "ms"); expect(match.matches[0]).toBe( "Well, we need a colon: somewhere".substring(21, 22) ); @@ -767,42 +767,42 @@ it("line: 150 - matches : against '*** Fail if we don't'", () => { expectNotMatch(":", ["*** Fail if we don't"]); }); it("line: 151 - matches ([\\da-f:]+)$ against '0abc'", () => { - const match = exec("([\\da-f:]+)$", "0abc", "is"); + const match = exec("([\\da-f:]+)$", "0abc", "mis"); expect(match.matches[0]).toBe("0abc".substring(0, 4)); expect(match.matches[1]).toBe("0abc".substring(0, 4)); }); it("line: 152 - matches ([\\da-f:]+)$ against 'abc'", () => { - const match = exec("([\\da-f:]+)$", "abc", "is"); + const match = exec("([\\da-f:]+)$", "abc", "mis"); expect(match.matches[0]).toBe("abc".substring(0, 3)); expect(match.matches[1]).toBe("abc".substring(0, 3)); }); it("line: 153 - matches ([\\da-f:]+)$ against 'fed'", () => { - const match = exec("([\\da-f:]+)$", "fed", "is"); + const match = exec("([\\da-f:]+)$", "fed", "mis"); expect(match.matches[0]).toBe("fed".substring(0, 3)); expect(match.matches[1]).toBe("fed".substring(0, 3)); }); it("line: 154 - matches ([\\da-f:]+)$ against 'E'", () => { - const match = exec("([\\da-f:]+)$", "E", "is"); + const match = exec("([\\da-f:]+)$", "E", "mis"); expect(match.matches[0]).toBe("E".substring(0, 1)); expect(match.matches[1]).toBe("E".substring(0, 1)); }); it("line: 155 - matches ([\\da-f:]+)$ against '::'", () => { - const match = exec("([\\da-f:]+)$", "::", "is"); + const match = exec("([\\da-f:]+)$", "::", "mis"); expect(match.matches[0]).toBe("::".substring(0, 2)); expect(match.matches[1]).toBe("::".substring(0, 2)); }); it("line: 156 - matches ([\\da-f:]+)$ against '5f03:12C0::932e'", () => { - const match = exec("([\\da-f:]+)$", "5f03:12C0::932e", "is"); + const match = exec("([\\da-f:]+)$", "5f03:12C0::932e", "mis"); expect(match.matches[0]).toBe("5f03:12C0::932e".substring(0, 15)); expect(match.matches[1]).toBe("5f03:12C0::932e".substring(0, 15)); }); it("line: 157 - matches ([\\da-f:]+)$ against 'fed def'", () => { - const match = exec("([\\da-f:]+)$", "fed def", "is"); + const match = exec("([\\da-f:]+)$", "fed def", "mis"); expect(match.matches[0]).toBe("fed def".substring(4, 7)); expect(match.matches[1]).toBe("fed def".substring(4, 7)); }); it("line: 158 - matches ([\\da-f:]+)$ against 'Any old stuff'", () => { - const match = exec("([\\da-f:]+)$", "Any old stuff", "is"); + const match = exec("([\\da-f:]+)$", "Any old stuff", "mis"); expect(match.matches[0]).toBe("Any old stuff".substring(11, 13)); expect(match.matches[1]).toBe("Any old stuff".substring(11, 13)); }); @@ -822,7 +822,7 @@ it("line: 163 - matches ^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$ against '.1. const match = exec( "^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", ".1.2.3", - "s" + "ms" ); expect(match.matches[0]).toBe(".1.2.3".substring(0, 6)); expect(match.matches[1]).toBe(".1.2.3".substring(1, 2)); @@ -833,7 +833,7 @@ it("line: 164 - matches ^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$ against 'A.1 const match = exec( "^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$", "A.12.123.0", - "s" + "ms" ); expect(match.matches[0]).toBe("A.12.123.0".substring(0, 10)); expect(match.matches[1]).toBe("A.12.123.0".substring(2, 4)); @@ -853,7 +853,7 @@ it("line: 168 - matches ^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$ aga const match = exec( "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$", "1 IN SOA non-sp1 non-sp2(", - "s" + "ms" ); expect(match.matches[0]).toBe("1 IN SOA non-sp1 non-sp2(".substring(0, 25)); expect(match.matches[1]).toBe("1 IN SOA non-sp1 non-sp2(".substring(0, 1)); @@ -864,7 +864,7 @@ it("line: 169 - matches ^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$ aga const match = exec( "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$", "1 IN SOA non-sp1 non-sp2 (", - "s" + "ms" ); expect(match.matches[0]).toBe( "1 IN SOA non-sp1 non-sp2 (".substring(0, 40) @@ -888,7 +888,7 @@ it("line: 171 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "a.", - "s" + "ms" ); expect(match.matches[0]).toBe("a.".substring(0, 2)); }); @@ -896,7 +896,7 @@ it("line: 172 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "Z.", - "s" + "ms" ); expect(match.matches[0]).toBe("Z.".substring(0, 2)); }); @@ -904,7 +904,7 @@ it("line: 173 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "2.", - "s" + "ms" ); expect(match.matches[0]).toBe("2.".substring(0, 2)); }); @@ -912,7 +912,7 @@ it("line: 174 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "ab-c.pq-r.", - "s" + "ms" ); expect(match.matches[0]).toBe("ab-c.pq-r.".substring(0, 10)); expect(match.matches[1]).toBe("ab-c.pq-r.".substring(4, 9)); @@ -921,7 +921,7 @@ it("line: 175 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "sxk.zzz.ac.uk.", - "s" + "ms" ); expect(match.matches[0]).toBe("sxk.zzz.ac.uk.".substring(0, 14)); expect(match.matches[1]).toBe("sxk.zzz.ac.uk.".substring(10, 13)); @@ -930,7 +930,7 @@ it("line: 176 - matches ^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-] const match = exec( "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$", "x-.y-.", - "s" + "ms" ); expect(match.matches[0]).toBe("x-.y-.".substring(0, 6)); expect(match.matches[1]).toBe("x-.y-.".substring(2, 5)); @@ -945,7 +945,7 @@ it("line: 178 - matches ^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d const match = exec( "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$", "*.a", - "s" + "ms" ); expect(match.matches[0]).toBe("*.a".substring(0, 3)); }); @@ -953,7 +953,7 @@ it("line: 179 - matches ^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d const match = exec( "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$", "*.b0-a", - "s" + "ms" ); expect(match.matches[0]).toBe("*.b0-a".substring(0, 6)); expect(match.matches[1]).toBe("*.b0-a".substring(3, 6)); @@ -962,7 +962,7 @@ it("line: 180 - matches ^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d const match = exec( "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$", "*.c3-b.c", - "s" + "ms" ); expect(match.matches[0]).toBe("*.c3-b.c".substring(0, 8)); expect(match.matches[1]).toBe("*.c3-b.c".substring(3, 6)); @@ -972,7 +972,7 @@ it("line: 181 - matches ^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d const match = exec( "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$", "*.c-a.b-c", - "s" + "ms" ); expect(match.matches[0]).toBe("*.c-a.b-c".substring(0, 9)); expect(match.matches[1]).toBe("*.c-a.b-c".substring(3, 5)); @@ -1007,31 +1007,31 @@ xit("line: 186 - non capturing groups not supported", () => {}); xit("line: 187 - non capturing groups not supported", () => {}); xit("line: 188 - non capturing groups not supported", () => {}); it("line: 189 - matches ^[\\da-f](\\.[\\da-f])*$ against 'a.b.c.d'", () => { - const match = exec("^[\\da-f](\\.[\\da-f])*$", "a.b.c.d", "is"); + const match = exec("^[\\da-f](\\.[\\da-f])*$", "a.b.c.d", "mis"); expect(match.matches[0]).toBe("a.b.c.d".substring(0, 7)); expect(match.matches[1]).toBe("a.b.c.d".substring(5, 7)); }); it("line: 190 - matches ^[\\da-f](\\.[\\da-f])*$ against 'A.B.C.D'", () => { - const match = exec("^[\\da-f](\\.[\\da-f])*$", "A.B.C.D", "is"); + const match = exec("^[\\da-f](\\.[\\da-f])*$", "A.B.C.D", "mis"); expect(match.matches[0]).toBe("A.B.C.D".substring(0, 7)); expect(match.matches[1]).toBe("A.B.C.D".substring(5, 7)); }); it("line: 191 - matches ^[\\da-f](\\.[\\da-f])*$ against 'a.b.c.1.2.3.C'", () => { - const match = exec("^[\\da-f](\\.[\\da-f])*$", "a.b.c.1.2.3.C", "is"); + const match = exec("^[\\da-f](\\.[\\da-f])*$", "a.b.c.1.2.3.C", "mis"); expect(match.matches[0]).toBe("a.b.c.1.2.3.C".substring(0, 13)); expect(match.matches[1]).toBe("a.b.c.1.2.3.C".substring(11, 13)); }); it('line: 192 - matches ^".*"\\s*(;.*)?$ against \'"1234"\'', () => { - const match = exec('^".*"\\s*(;.*)?$', '"1234"', "s"); + const match = exec('^".*"\\s*(;.*)?$', '"1234"', "ms"); expect(match.matches[0]).toBe('"1234"'.substring(0, 6)); }); it('line: 193 - matches ^".*"\\s*(;.*)?$ against \'"abcd" ;\'', () => { - const match = exec('^".*"\\s*(;.*)?$', '"abcd" ;', "s"); + const match = exec('^".*"\\s*(;.*)?$', '"abcd" ;', "ms"); expect(match.matches[0]).toBe('"abcd" ;'.substring(0, 8)); expect(match.matches[1]).toBe('"abcd" ;'.substring(7, 8)); }); it('line: 194 - matches ^".*"\\s*(;.*)?$ against \'"" ; rhubarb\'', () => { - const match = exec('^".*"\\s*(;.*)?$', '"" ; rhubarb', "s"); + const match = exec('^".*"\\s*(;.*)?$', '"" ; rhubarb', "ms"); expect(match.matches[0]).toBe('"" ; rhubarb'.substring(0, 12)); expect(match.matches[1]).toBe('"" ; rhubarb'.substring(3, 12)); }); @@ -1039,7 +1039,7 @@ it('line: 195 - matches ^".*"\\s*(;.*)?$ against \'"1234" : things\'', () => { expectNotMatch('^".*"\\s*(;.*)?$', ['"1234" : things']); }); it("line: 196 - matches ^$ against ''", () => { - const match = exec("^$", "", "s"); + const match = exec("^$", "", "ms"); expect(match.matches[0]).toBe("".substring(0, 0)); }); xit("line: 197 - non capturing groups not supported", () => {}); @@ -1060,7 +1060,7 @@ it("line: 207 - matches ^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$ against 'abcdefhi const match = exec( "^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$", "abcdefhijklm", - "s" + "ms" ); expect(match.matches[0]).toBe("abcdefhijklm".substring(0, 12)); expect(match.matches[1]).toBe("abcdefhijklm".substring(0, 3)); @@ -1079,165 +1079,165 @@ it("line: 207 - matches ^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$ against 'abcdefhi xit("line: 208 - non capturing groups not supported", () => {}); xit("line: 209 - back references are not supported", () => {}); it("line: 210 - matches ^[.^$|()*+?{,}]+ against '.^$(*+)|{?,?}'", () => { - const match = exec("^[.^$|()*+?{,}]+", ".^$(*+)|{?,?}", "s"); + const match = exec("^[.^$|()*+?{,}]+", ".^$(*+)|{?,?}", "ms"); expect(match.matches[0]).toBe(".^$(*+)|{?,?}".substring(0, 13)); }); it("line: 211 - matches ^a*\\w against 'z'", () => { - const match = exec("^a*\\w", "z", "s"); + const match = exec("^a*\\w", "z", "ms"); expect(match.matches[0]).toBe("z".substring(0, 1)); }); it("line: 212 - matches ^a*\\w against 'az'", () => { - const match = exec("^a*\\w", "az", "s"); + const match = exec("^a*\\w", "az", "ms"); expect(match.matches[0]).toBe("az".substring(0, 2)); }); it("line: 213 - matches ^a*\\w against 'aaaz'", () => { - const match = exec("^a*\\w", "aaaz", "s"); + const match = exec("^a*\\w", "aaaz", "ms"); expect(match.matches[0]).toBe("aaaz".substring(0, 4)); }); it("line: 214 - matches ^a*\\w against 'a'", () => { - const match = exec("^a*\\w", "a", "s"); + const match = exec("^a*\\w", "a", "ms"); expect(match.matches[0]).toBe("a".substring(0, 1)); }); it("line: 215 - matches ^a*\\w against 'aa'", () => { - const match = exec("^a*\\w", "aa", "s"); + const match = exec("^a*\\w", "aa", "ms"); expect(match.matches[0]).toBe("aa".substring(0, 2)); }); it("line: 216 - matches ^a*\\w against 'aaaa'", () => { - const match = exec("^a*\\w", "aaaa", "s"); + const match = exec("^a*\\w", "aaaa", "ms"); expect(match.matches[0]).toBe("aaaa".substring(0, 4)); }); it("line: 217 - matches ^a*\\w against 'a+'", () => { - const match = exec("^a*\\w", "a+", "s"); + const match = exec("^a*\\w", "a+", "ms"); expect(match.matches[0]).toBe("a+".substring(0, 1)); }); it("line: 218 - matches ^a*\\w against 'aa+'", () => { - const match = exec("^a*\\w", "aa+", "s"); + const match = exec("^a*\\w", "aa+", "ms"); expect(match.matches[0]).toBe("aa+".substring(0, 2)); }); it("line: 219 - matches ^a*?\\w against 'z'", () => { - const match = exec("^a*?\\w", "z", "s"); + const match = exec("^a*?\\w", "z", "ms"); expect(match.matches[0]).toBe("z".substring(0, 1)); }); it("line: 220 - matches ^a*?\\w against 'az'", () => { - const match = exec("^a*?\\w", "az", "s"); + const match = exec("^a*?\\w", "az", "ms"); expect(match.matches[0]).toBe("az".substring(0, 1)); }); it("line: 221 - matches ^a*?\\w against 'aaaz'", () => { - const match = exec("^a*?\\w", "aaaz", "s"); + const match = exec("^a*?\\w", "aaaz", "ms"); expect(match.matches[0]).toBe("aaaz".substring(0, 1)); }); it("line: 222 - matches ^a*?\\w against 'a'", () => { - const match = exec("^a*?\\w", "a", "s"); + const match = exec("^a*?\\w", "a", "ms"); expect(match.matches[0]).toBe("a".substring(0, 1)); }); it("line: 223 - matches ^a*?\\w against 'aa'", () => { - const match = exec("^a*?\\w", "aa", "s"); + const match = exec("^a*?\\w", "aa", "ms"); expect(match.matches[0]).toBe("aa".substring(0, 1)); }); it("line: 224 - matches ^a*?\\w against 'aaaa'", () => { - const match = exec("^a*?\\w", "aaaa", "s"); + const match = exec("^a*?\\w", "aaaa", "ms"); expect(match.matches[0]).toBe("aaaa".substring(0, 1)); }); it("line: 225 - matches ^a*?\\w against 'a+'", () => { - const match = exec("^a*?\\w", "a+", "s"); + const match = exec("^a*?\\w", "a+", "ms"); expect(match.matches[0]).toBe("a+".substring(0, 1)); }); it("line: 226 - matches ^a*?\\w against 'aa+'", () => { - const match = exec("^a*?\\w", "aa+", "s"); + const match = exec("^a*?\\w", "aa+", "ms"); expect(match.matches[0]).toBe("aa+".substring(0, 1)); }); it("line: 227 - matches ^a+\\w against 'az'", () => { - const match = exec("^a+\\w", "az", "s"); + const match = exec("^a+\\w", "az", "ms"); expect(match.matches[0]).toBe("az".substring(0, 2)); }); it("line: 228 - matches ^a+\\w against 'aaaz'", () => { - const match = exec("^a+\\w", "aaaz", "s"); + const match = exec("^a+\\w", "aaaz", "ms"); expect(match.matches[0]).toBe("aaaz".substring(0, 4)); }); it("line: 229 - matches ^a+\\w against 'aa'", () => { - const match = exec("^a+\\w", "aa", "s"); + const match = exec("^a+\\w", "aa", "ms"); expect(match.matches[0]).toBe("aa".substring(0, 2)); }); it("line: 230 - matches ^a+\\w against 'aaaa'", () => { - const match = exec("^a+\\w", "aaaa", "s"); + const match = exec("^a+\\w", "aaaa", "ms"); expect(match.matches[0]).toBe("aaaa".substring(0, 4)); }); it("line: 231 - matches ^a+\\w against 'aa+'", () => { - const match = exec("^a+\\w", "aa+", "s"); + const match = exec("^a+\\w", "aa+", "ms"); expect(match.matches[0]).toBe("aa+".substring(0, 2)); }); it("line: 232 - matches ^a+?\\w against 'az'", () => { - const match = exec("^a+?\\w", "az", "s"); + const match = exec("^a+?\\w", "az", "ms"); expect(match.matches[0]).toBe("az".substring(0, 2)); }); it("line: 233 - matches ^a+?\\w against 'aaaz'", () => { - const match = exec("^a+?\\w", "aaaz", "s"); + const match = exec("^a+?\\w", "aaaz", "ms"); expect(match.matches[0]).toBe("aaaz".substring(0, 2)); }); it("line: 234 - matches ^a+?\\w against 'aa'", () => { - const match = exec("^a+?\\w", "aa", "s"); + const match = exec("^a+?\\w", "aa", "ms"); expect(match.matches[0]).toBe("aa".substring(0, 2)); }); it("line: 235 - matches ^a+?\\w against 'aaaa'", () => { - const match = exec("^a+?\\w", "aaaa", "s"); + const match = exec("^a+?\\w", "aaaa", "ms"); expect(match.matches[0]).toBe("aaaa".substring(0, 2)); }); it("line: 236 - matches ^a+?\\w against 'aa+'", () => { - const match = exec("^a+?\\w", "aa+", "s"); + const match = exec("^a+?\\w", "aa+", "ms"); expect(match.matches[0]).toBe("aa+".substring(0, 2)); }); it("line: 237 - matches ^\\d{8}\\w{2,} against '1234567890'", () => { - const match = exec("^\\d{8}\\w{2,}", "1234567890", "s"); + const match = exec("^\\d{8}\\w{2,}", "1234567890", "ms"); expect(match.matches[0]).toBe("1234567890".substring(0, 10)); }); it("line: 238 - matches ^\\d{8}\\w{2,} against '12345678ab'", () => { - const match = exec("^\\d{8}\\w{2,}", "12345678ab", "s"); + const match = exec("^\\d{8}\\w{2,}", "12345678ab", "ms"); expect(match.matches[0]).toBe("12345678ab".substring(0, 10)); }); it("line: 239 - matches ^\\d{8}\\w{2,} against '12345678__'", () => { - const match = exec("^\\d{8}\\w{2,}", "12345678__", "s"); + const match = exec("^\\d{8}\\w{2,}", "12345678__", "ms"); expect(match.matches[0]).toBe("12345678__".substring(0, 10)); }); it("line: 240 - matches ^\\d{8}\\w{2,} against '1234567'", () => { expectNotMatch("^\\d{8}\\w{2,}", ["1234567"]); }); it("line: 241 - matches ^[aeiou\\d]{4,5}$ against 'uoie'", () => { - const match = exec("^[aeiou\\d]{4,5}$", "uoie", "s"); + const match = exec("^[aeiou\\d]{4,5}$", "uoie", "ms"); expect(match.matches[0]).toBe("uoie".substring(0, 4)); }); it("line: 242 - matches ^[aeiou\\d]{4,5}$ against '1234'", () => { - const match = exec("^[aeiou\\d]{4,5}$", "1234", "s"); + const match = exec("^[aeiou\\d]{4,5}$", "1234", "ms"); expect(match.matches[0]).toBe("1234".substring(0, 4)); }); it("line: 243 - matches ^[aeiou\\d]{4,5}$ against '12345'", () => { - const match = exec("^[aeiou\\d]{4,5}$", "12345", "s"); + const match = exec("^[aeiou\\d]{4,5}$", "12345", "ms"); expect(match.matches[0]).toBe("12345".substring(0, 5)); }); it("line: 244 - matches ^[aeiou\\d]{4,5}$ against 'aaaaa'", () => { - const match = exec("^[aeiou\\d]{4,5}$", "aaaaa", "s"); + const match = exec("^[aeiou\\d]{4,5}$", "aaaaa", "ms"); expect(match.matches[0]).toBe("aaaaa".substring(0, 5)); }); it("line: 245 - matches ^[aeiou\\d]{4,5}$ against '123456'", () => { expectNotMatch("^[aeiou\\d]{4,5}$", ["123456"]); }); it("line: 246 - matches ^[aeiou\\d]{4,5}? against 'uoie'", () => { - const match = exec("^[aeiou\\d]{4,5}?", "uoie", "s"); + const match = exec("^[aeiou\\d]{4,5}?", "uoie", "ms"); expect(match.matches[0]).toBe("uoie".substring(0, 4)); }); it("line: 247 - matches ^[aeiou\\d]{4,5}? against '1234'", () => { - const match = exec("^[aeiou\\d]{4,5}?", "1234", "s"); + const match = exec("^[aeiou\\d]{4,5}?", "1234", "ms"); expect(match.matches[0]).toBe("1234".substring(0, 4)); }); it("line: 248 - matches ^[aeiou\\d]{4,5}? against '12345'", () => { - const match = exec("^[aeiou\\d]{4,5}?", "12345", "s"); + const match = exec("^[aeiou\\d]{4,5}?", "12345", "ms"); expect(match.matches[0]).toBe("12345".substring(0, 4)); }); it("line: 249 - matches ^[aeiou\\d]{4,5}? against 'aaaaa'", () => { - const match = exec("^[aeiou\\d]{4,5}?", "aaaaa", "s"); + const match = exec("^[aeiou\\d]{4,5}?", "aaaaa", "ms"); expect(match.matches[0]).toBe("aaaaa".substring(0, 4)); }); it("line: 250 - matches ^[aeiou\\d]{4,5}? against '123456'", () => { - const match = exec("^[aeiou\\d]{4,5}?", "123456", "s"); + const match = exec("^[aeiou\\d]{4,5}?", "123456", "ms"); expect(match.matches[0]).toBe("123456".substring(0, 4)); }); xit("line: 251 - back references are not supported", () => {}); @@ -1254,7 +1254,7 @@ it("line: 261 - matches ^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA- const match = exec( "^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]", "From abcd Mon Sep 01 12:33:02 1997", - "s" + "ms" ); expect(match.matches[0]).toBe( "From abcd Mon Sep 01 12:33:02 1997".substring(0, 27) @@ -1267,7 +1267,7 @@ it("line: 262 - matches ^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d: const match = exec( "^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d:\\d\\d", "From abcd Mon Sep 01 12:33:02 1997", - "s" + "ms" ); expect(match.matches[0]).toBe( "From abcd Mon Sep 01 12:33:02 1997".substring(0, 27) @@ -1280,7 +1280,7 @@ it("line: 263 - matches ^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d: const match = exec( "^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d:\\d\\d", "From abcd Mon Sep 1 12:33:02 1997", - "s" + "ms" ); expect(match.matches[0]).toBe( "From abcd Mon Sep 1 12:33:02 1997".substring(0, 27) @@ -1296,11 +1296,11 @@ it("line: 264 - matches ^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d: ); }); it("line: 265 - matches ^12.34 against '12\n34'", () => { - const match = exec("^12.34", "12\n34", "s"); + const match = exec("^12.34", "12\n34", "ms"); expect(match.matches[0]).toBe("12\n34".substring(0, 5)); }); it("line: 266 - matches ^12.34 against '12\r34'", () => { - const match = exec("^12.34", "12\r34", "s"); + const match = exec("^12.34", "12\r34", "ms"); expect(match.matches[0]).toBe("12\r34".substring(0, 5)); }); xit("line: 267 - non capturing groups not supported", () => {}); @@ -1322,17 +1322,17 @@ xit("line: 288 - non capturing groups not supported", () => {}); xit("line: 289 - non capturing groups not supported", () => {}); xit("line: 290 - the test behaviour differs between PCRE and JS", () => {}); it("line: 291 - matches ^[ab]{1,3}?(ab*|b) against 'aabbbbb'", () => { - const match = exec("^[ab]{1,3}?(ab*|b)", "aabbbbb", "s"); + const match = exec("^[ab]{1,3}?(ab*|b)", "aabbbbb", "ms"); expect(match.matches[0]).toBe("aabbbbb".substring(0, 7)); expect(match.matches[1]).toBe("aabbbbb".substring(1, 7)); }); it("line: 292 - matches ^[ab]{1,3}?(ab*?|b) against 'aabbbbb'", () => { - const match = exec("^[ab]{1,3}?(ab*?|b)", "aabbbbb", "s"); + const match = exec("^[ab]{1,3}?(ab*?|b)", "aabbbbb", "ms"); expect(match.matches[0]).toBe("aabbbbb".substring(0, 2)); expect(match.matches[1]).toBe("aabbbbb".substring(1, 2)); }); it("line: 293 - matches ^[ab]{1,3}(ab*?|b) against 'aabbbbb'", () => { - const match = exec("^[ab]{1,3}(ab*?|b)", "aabbbbb", "s"); + const match = exec("^[ab]{1,3}(ab*?|b)", "aabbbbb", "ms"); expect(match.matches[0]).toBe("aabbbbb".substring(0, 4)); expect(match.matches[1]).toBe("aabbbbb".substring(3, 4)); }); @@ -1357,12 +1357,12 @@ xit("line: 1084 - back references are not supported", () => {}); xit("line: 1085 - back references are not supported", () => {}); xit("line: 1086 - test encoding issue", () => {}); xit("line: 1087 - test requires a substring function", () => {}); -xit("line: 1088 - requires triage", () => {}); +xit("line: 1088 - test requires a substring function", () => {}); it("line: 1089 - matches abc\\x0def\\x00pqr\\x000xyz\\x0000AB against 'abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE'", () => { const match = exec( "abc\\x0def\\x00pqr\\x000xyz\\x0000AB", "abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE", - "s" + "ms" ); expect(match.matches[0]).toBe( "abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE".substring(7, 27) @@ -1372,7 +1372,7 @@ it("line: 1090 - matches abc\\x0def\\x00pqr\\x000xyz\\x0000AB against 'abc456 ab const match = exec( "abc\\x0def\\x00pqr\\x000xyz\\x0000AB", "abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE", - "s" + "ms" ); expect(match.matches[0]).toBe( "abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE".substring(7, 27) @@ -1392,23 +1392,23 @@ xit("line: 1101 - back references are not supported", () => {}); xit("line: 1102 - test contains an octal escape sequence", () => {}); xit("line 1103 - issue with parsing the test itself", () => {}); it("line: 1104 - matches ^\\s against '\x0cxyz'", () => { - const match = exec("^\\s", "\x0cxyz", "s"); + const match = exec("^\\s", "\x0cxyz", "ms"); expect(match.matches[0]).toBe("\x0cxyz".substring(0, 1)); }); it("line: 1105 - matches ^\\s against '\fabc'", () => { - const match = exec("^\\s", "\fabc", "s"); + const match = exec("^\\s", "\fabc", "ms"); expect(match.matches[0]).toBe("\fabc".substring(0, 1)); }); it("line: 1106 - matches ^\\s against '\nabc'", () => { - const match = exec("^\\s", "\nabc", "s"); + const match = exec("^\\s", "\nabc", "ms"); expect(match.matches[0]).toBe("\nabc".substring(0, 1)); }); it("line: 1107 - matches ^\\s against '\rabc'", () => { - const match = exec("^\\s", "\rabc", "s"); + const match = exec("^\\s", "\rabc", "ms"); expect(match.matches[0]).toBe("\rabc".substring(0, 1)); }); it("line: 1108 - matches ^\\s against '\tabc'", () => { - const match = exec("^\\s", "\tabc", "s"); + const match = exec("^\\s", "\tabc", "ms"); expect(match.matches[0]).toBe("\tabc".substring(0, 1)); }); it("line: 1109 - matches ^\\s against 'abc'", () => { @@ -1438,15 +1438,15 @@ xit("line: 1133 - back references are not supported", () => {}); xit("line: 1134 - back references are not supported", () => {}); xit("line: 1135 - back references are not supported", () => {}); it("line: 1136 - matches ab{1,3}bc against 'abbbbc'", () => { - const match = exec("ab{1,3}bc", "abbbbc", "s"); + const match = exec("ab{1,3}bc", "abbbbc", "ms"); expect(match.matches[0]).toBe("abbbbc".substring(0, 6)); }); it("line: 1137 - matches ab{1,3}bc against 'abbbc'", () => { - const match = exec("ab{1,3}bc", "abbbc", "s"); + const match = exec("ab{1,3}bc", "abbbc", "ms"); expect(match.matches[0]).toBe("abbbc".substring(0, 5)); }); it("line: 1138 - matches ab{1,3}bc against 'abbc'", () => { - const match = exec("ab{1,3}bc", "abbc", "s"); + const match = exec("ab{1,3}bc", "abbc", "ms"); expect(match.matches[0]).toBe("abbc".substring(0, 4)); }); it("line: 1139 - matches ab{1,3}bc against 'abc'", () => { @@ -1459,7 +1459,7 @@ it("line: 1141 - matches ([^.]*)\\.([^:]*):[T ]+(.*) against 'track1.title:TBlah const match = exec( "([^.]*)\\.([^:]*):[T ]+(.*)", "track1.title:TBlah blah blah", - "s" + "ms" ); expect(match.matches[0]).toBe( "track1.title:TBlah blah blah".substring(0, 28) @@ -1476,7 +1476,7 @@ it("line: 1142 - matches ([^.]*)\\.([^:]*):[T ]+(.*) against 'track1.title:TBlah const match = exec( "([^.]*)\\.([^:]*):[T ]+(.*)", "track1.title:TBlah blah blah", - "is" + "mis" ); expect(match.matches[0]).toBe( "track1.title:TBlah blah blah".substring(0, 28) @@ -1493,7 +1493,7 @@ it("line: 1143 - matches ([^.]*)\\.([^:]*):[t ]+(.*) against 'track1.title:TBlah const match = exec( "([^.]*)\\.([^:]*):[t ]+(.*)", "track1.title:TBlah blah blah", - "is" + "mis" ); expect(match.matches[0]).toBe( "track1.title:TBlah blah blah".substring(0, 28) @@ -1507,25 +1507,37 @@ it("line: 1143 - matches ([^.]*)\\.([^:]*):[t ]+(.*) against 'track1.title:TBlah ); }); it("line: 1144 - matches ^[W-c]+$ against 'WXY_^abc'", () => { - const match = exec("^[W-c]+$", "WXY_^abc", "s"); + const match = exec("^[W-c]+$", "WXY_^abc", "ms"); expect(match.matches[0]).toBe("WXY_^abc".substring(0, 8)); }); it("line: 1145 - matches ^[W-c]+$ against 'wxy'", () => { expectNotMatch("^[W-c]+$", ["wxy"]); }); it("line: 1146 - matches ^[W-c]+$ against 'WXY_^abc'", () => { - const match = exec("^[W-c]+$", "WXY_^abc", "is"); + const match = exec("^[W-c]+$", "WXY_^abc", "mis"); expect(match.matches[0]).toBe("WXY_^abc".substring(0, 8)); }); -xit("line: 1147 - requires triage", () => {}); -xit("line: 1148 - requires triage", () => {}); -xit("line: 1149 - requires triage", () => {}); -xit("line: 1150 - multi line regex not supported yet!", () => {}); -xit("line: 1151 - multi line regex not supported yet!", () => {}); -xit("line: 1152 - multi line regex not supported yet!", () => {}); -xit("line: 1153 - multi line regex not supported yet!", () => {}); +xit("line: 1147 - does not support hex notification in character sets", () => {}); +xit("line: 1148 - does not support hex notification in character sets", () => {}); +xit("line: 1149 - does not support hex notification in character sets", () => {}); +it("line: 1150 - matches ^abc$ against 'abc'", () => { + const match = exec("^abc$", "abc", "ms"); + expect(match.matches[0]).toBe("abc".substring(0, 3)); +}); +it("line: 1151 - matches ^abc$ against 'qqq\nabc'", () => { + const match = exec("^abc$", "qqq\nabc", "m"); + expect(match.matches[0]).toBe("qqq\nabc".substring(4, 7)); +}); +it("line: 1152 - matches ^abc$ against 'abc\nzzz'", () => { + const match = exec("^abc$", "abc\nzzz", "m"); + expect(match.matches[0]).toBe("abc\nzzz".substring(0, 3)); +}); +it("line: 1153 - matches ^abc$ against 'qqq\nabc\nzzz'", () => { + const match = exec("^abc$", "qqq\nabc\nzzz", "m"); + expect(match.matches[0]).toBe("qqq\nabc\nzzz".substring(4, 7)); +}); it("line: 1154 - matches ^abc$ against 'abc'", () => { - const match = exec("^abc$", "abc", "s"); + const match = exec("^abc$", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 3)); }); it("line: 1155 - matches ^abc$ against 'qqq\nabc'", () => { @@ -1537,53 +1549,61 @@ it("line: 1156 - matches ^abc$ against 'abc\nzzz'", () => { it("line: 1157 - matches ^abc$ against 'qqq\nabc\nzzz'", () => { expectNotMatch("^abc$", ["qqq\nabc\nzzz"]); }); -xit("line: 1158 - multi line regex not supported yet!", () => {}); -xit("line: 1159 - multi line regex not supported yet!", () => {}); -xit("line: 1160 - multi line regex not supported yet!", () => {}); -xit("line: 1161 - multi line regex not supported yet!", () => {}); -xit("line: 1162 - multi line regex not supported yet!", () => {}); -xit("line: 1163 - requires triage", () => {}); -xit("line: 1164 - multi line regex not supported yet!", () => {}); +xit("line: 1158 - test regex contains syntax not supported in JS", () => {}); +it("line: 1159 - matches \\Aabc\\Z against 'abc\n '", () => { + expectNotMatch("\\Aabc\\Z", ["abc\n "]); +}); +it("line: 1160 - matches \\Aabc\\Z against 'qqq\nabc'", () => { + expectNotMatch("\\Aabc\\Z", ["qqq\nabc"]); +}); +it("line: 1161 - matches \\Aabc\\Z against 'abc\nzzz'", () => { + expectNotMatch("\\Aabc\\Z", ["abc\nzzz"]); +}); +it("line: 1162 - matches \\Aabc\\Z against 'qqq\nabc\nzzz'", () => { + expectNotMatch("\\Aabc\\Z", ["qqq\nabc\nzzz"]); +}); +xit("line: 1163 - JS does not support the A Z syntax for start and end of string", () => {}); +xit("line: 1164 - JS does not support the A Z syntax for start and end of string", () => {}); xit("line: 1165 - non capturing groups not supported", () => {}); xit("line: 1166 - non capturing groups not supported", () => {}); it("line: 1167 - matches [-az]+ against 'az-'", () => { - const match = exec("[-az]+", "az-", "s"); + const match = exec("[-az]+", "az-", "ms"); expect(match.matches[0]).toBe("az-".substring(0, 3)); }); it("line: 1168 - matches [-az]+ against 'b'", () => { expectNotMatch("[-az]+", ["b"]); }); it("line: 1169 - matches [az-]+ against 'za-'", () => { - const match = exec("[az-]+", "za-", "s"); + const match = exec("[az-]+", "za-", "ms"); expect(match.matches[0]).toBe("za-".substring(0, 3)); }); it("line: 1170 - matches [az-]+ against 'b'", () => { expectNotMatch("[az-]+", ["b"]); }); it("line: 1171 - matches [a\\-z]+ against 'a-z'", () => { - const match = exec("[a\\-z]+", "a-z", "s"); + const match = exec("[a\\-z]+", "a-z", "ms"); expect(match.matches[0]).toBe("a-z".substring(0, 3)); }); it("line: 1172 - matches [a\\-z]+ against 'b'", () => { expectNotMatch("[a\\-z]+", ["b"]); }); it("line: 1173 - matches [a-z]+ against 'abcdxyz'", () => { - const match = exec("[a-z]+", "abcdxyz", "s"); + const match = exec("[a-z]+", "abcdxyz", "ms"); expect(match.matches[0]).toBe("abcdxyz".substring(0, 7)); }); it("line: 1174 - matches [\\d-]+ against '12-34'", () => { - const match = exec("[\\d-]+", "12-34", "s"); + const match = exec("[\\d-]+", "12-34", "ms"); expect(match.matches[0]).toBe("12-34".substring(0, 5)); }); it("line: 1175 - matches [\\d-]+ against 'aaa'", () => { expectNotMatch("[\\d-]+", ["aaa"]); }); it("line: 1178 - matches \\x5c against '\\'", () => { - const match = exec("\\x5c", "\\", "s"); + const match = exec("\\x5c", "\\", "ms"); expect(match.matches[0]).toBe("\\".substring(0, 1)); }); it("line: 1179 - matches \\x20Z against 'the Zoo'", () => { - const match = exec("\\x20Z", "the Zoo", "s"); + const match = exec("\\x20Z", "the Zoo", "ms"); expect(match.matches[0]).toBe("the Zoo".substring(3, 5)); }); it("line: 1180 - matches \\x20Z against 'Zulu'", () => { @@ -1593,35 +1613,45 @@ xit("line: 1181 - back references are not supported", () => {}); xit("line: 1182 - back references are not supported", () => {}); xit("line: 1183 - back references are not supported", () => {}); it("line: 1184 - matches (main(O)?)+ against 'mainmain'", () => { - const match = exec("(main(O)?)+", "mainmain", "s"); + const match = exec("(main(O)?)+", "mainmain", "ms"); expect(match.matches[0]).toBe("mainmain".substring(0, 8)); expect(match.matches[1]).toBe("mainmain".substring(4, 8)); }); -xit("line 1185 - issue with parsing the test itself", () => {}); -xit("line 1186 - issue with parsing the test itself", () => {}); -xit("line 1187 - issue with parsing the test itself", () => {}); -xit("line 1188 - issue with parsing the test itself", () => {}); +it("line: 1185 - matches (main(O)?)+ against 'mainOmain'", () => { + const match = exec("(main(O)?)+", "mainOmain", "ms"); + expect(match.matches[0]).toBe("mainOmain".substring(0, 9)); + expect(match.matches[1]).toBe("mainOmain".substring(5, 9)); +}); +xit("line: 1186 - test indicates a malformed regex, whereas it appears OK in JS", () => {}); +xit("line: 1187 - test indicates a malformed regex, whereas it appears OK in JS", () => {}); +xit("line: 1188 - test indicates a malformed regex, whereas it appears OK in JS", () => {}); xit("line: 1189 - test indicates a malformed regex, whereas it appears OK in JS", () => {}); it("line: 1190 - matches ^a.b against 'a\rb'", () => { - const match = exec("^a.b", "a\rb", "s"); + const match = exec("^a.b", "a\rb", "ms"); expect(match.matches[0]).toBe("a\rb".substring(0, 3)); }); it("line: 1191 - matches ^a.b against 'a\nb'", () => { - const match = exec("^a.b", "a\nb", "s"); + const match = exec("^a.b", "a\nb", "ms"); expect(match.matches[0]).toBe("a\nb".substring(0, 3)); }); it("line: 1192 - matches abc$ against 'abc'", () => { - const match = exec("abc$", "abc", "s"); + const match = exec("abc$", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 3)); }); it("line: 1193 - matches abc$ against 'abc\n'", () => { expectNotMatch("abc$", ["abc\n"]); }); -xit("line: 1194 - multi line regex not supported yet!", () => {}); +it("line: 1194 - matches abc$ against 'abc\n'", () => { + const match = exec("abc$", "abc\n", "m"); + expect(match.matches[0]).toBe("abc\n".substring(0, 3)); +}); it("line: 1195 - matches abc$ against 'abc\ndef'", () => { expectNotMatch("abc$", ["abc\ndef"]); }); -xit("line: 1196 - multi line regex not supported yet!", () => {}); +it("line: 1196 - matches abc$ against 'abc\ndef'", () => { + const match = exec("abc$", "abc\ndef", "m"); + expect(match.matches[0]).toBe("abc\ndef".substring(0, 3)); +}); xit("line: 1197 - back references are not supported", () => {}); xit("line: 1198 - back references are not supported", () => {}); xit("line: 1199 - back references are not supported", () => {}); @@ -1648,15 +1678,15 @@ xit("line: 1219 - back references are not supported", () => {}); xit("line: 1220 - back references are not supported", () => {}); xit("line: 1221 - non capturing groups not supported", () => {}); it("line: 1223 - matches ab\\gdef against 'abgdef'", () => { - const match = exec("ab\\gdef", "abgdef", "s"); + const match = exec("ab\\gdef", "abgdef", "ms"); expect(match.matches[0]).toBe("abgdef".substring(0, 6)); }); it("line: 1224 - matches a{0}bc against 'bc'", () => { - const match = exec("a{0}bc", "bc", "s"); + const match = exec("a{0}bc", "bc", "ms"); expect(match.matches[0]).toBe("bc".substring(0, 2)); }); it("line: 1225 - matches (a|(bc)){0,0}?xyz against 'xyz'", () => { - const match = exec("(a|(bc)){0,0}?xyz", "xyz", "s"); + const match = exec("(a|(bc)){0,0}?xyz", "xyz", "ms"); expect(match.matches[0]).toBe("xyz".substring(0, 3)); }); xit("line: 1226 - back references are not supported", () => {}); @@ -1672,45 +1702,47 @@ xit("line: 1235 - word boundary class not supported yet!", () => {}); xit("line: 1236 - word boundary class not supported yet!", () => {}); xit("line: 1237 - word boundary class not supported yet!", () => {}); xit("line: 1238 - word boundary class not supported yet!", () => {}); -xit("line: 1239 - requires triage", () => {}); +it("line: 1239 - matches ^([^a])([^\\f])([^c]*)([^d]{3,4}) against 'b\fc...'", () => { + expectNotMatch("^([^a])([^\\f])([^c]*)([^d]{3,4})", ["b\fc..."]); +}); it("line: 1240 - matches [^a] against 'Abc'", () => { - const match = exec("[^a]", "Abc", "s"); + const match = exec("[^a]", "Abc", "ms"); expect(match.matches[0]).toBe("Abc".substring(0, 1)); }); it("line: 1241 - matches [^a] against 'Abc '", () => { - const match = exec("[^a]", "Abc ", "is"); + const match = exec("[^a]", "Abc ", "mis"); expect(match.matches[0]).toBe("Abc ".substring(1, 2)); }); it("line: 1242 - matches [^a]+ against 'AAAaAbc'", () => { - const match = exec("[^a]+", "AAAaAbc", "s"); + const match = exec("[^a]+", "AAAaAbc", "ms"); expect(match.matches[0]).toBe("AAAaAbc".substring(0, 3)); }); it("line: 1243 - matches [^a]+ against 'AAAaAbc '", () => { - const match = exec("[^a]+", "AAAaAbc ", "is"); + const match = exec("[^a]+", "AAAaAbc ", "mis"); expect(match.matches[0]).toBe("AAAaAbc ".substring(5, 8)); }); it("line: 1244 - matches [^a]+ against 'bbb\nccc'", () => { - const match = exec("[^a]+", "bbb\nccc", "s"); + const match = exec("[^a]+", "bbb\nccc", "ms"); expect(match.matches[0]).toBe("bbb\nccc".substring(0, 7)); }); it("line: 1245 - matches [^k]$ against 'abc'", () => { - const match = exec("[^k]$", "abc", "s"); + const match = exec("[^k]$", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(2, 3)); }); it("line: 1246 - matches [^k]$ against 'abk '", () => { - const match = exec("[^k]$", "abk ", "s"); + const match = exec("[^k]$", "abk ", "ms"); expect(match.matches[0]).toBe("abk ".substring(5, 6)); }); it("line: 1247 - matches [^k]{2,3}$ against 'abc'", () => { - const match = exec("[^k]{2,3}$", "abc", "s"); + const match = exec("[^k]{2,3}$", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 3)); }); it("line: 1248 - matches [^k]{2,3}$ against 'kbc'", () => { - const match = exec("[^k]{2,3}$", "kbc", "s"); + const match = exec("[^k]{2,3}$", "kbc", "ms"); expect(match.matches[0]).toBe("kbc".substring(1, 3)); }); it("line: 1249 - matches [^k]{2,3}$ against 'kabc '", () => { - const match = exec("[^k]{2,3}$", "kabc ", "s"); + const match = exec("[^k]{2,3}$", "kabc ", "ms"); expect(match.matches[0]).toBe("kabc ".substring(2, 5)); }); it("line: 1250 - matches [^k]{2,3}$ against 'abk'", () => { @@ -1723,11 +1755,11 @@ it("line: 1252 - matches [^k]{2,3}$ against 'akk '", () => { expectNotMatch("[^k]{2,3}$", ["akk "]); }); it("line: 1253 - matches ^\\d{8,}\\@.+[^k]$ against '12345678@a.b.c.d'", () => { - const match = exec("^\\d{8,}\\@.+[^k]$", "12345678@a.b.c.d", "s"); + const match = exec("^\\d{8,}\\@.+[^k]$", "12345678@a.b.c.d", "ms"); expect(match.matches[0]).toBe("12345678@a.b.c.d".substring(0, 16)); }); it("line: 1254 - matches ^\\d{8,}\\@.+[^k]$ against '123456789@x.y.z'", () => { - const match = exec("^\\d{8,}\\@.+[^k]$", "123456789@x.y.z", "s"); + const match = exec("^\\d{8,}\\@.+[^k]$", "123456789@x.y.z", "ms"); expect(match.matches[0]).toBe("123456789@x.y.z".substring(0, 15)); }); it("line: 1255 - matches ^\\d{8,}\\@.+[^k]$ against '12345678@x.y.uk'", () => { @@ -1740,35 +1772,35 @@ xit("line: 1257 - back references are not supported", () => {}); xit("line: 1258 - back references are not supported", () => {}); xit("line: 1259 - back references are not supported", () => {}); it("line: 1260 - matches [^a] against 'aaaabcd'", () => { - const match = exec("[^a]", "aaaabcd", "s"); + const match = exec("[^a]", "aaaabcd", "ms"); expect(match.matches[0]).toBe("aaaabcd".substring(4, 5)); }); it("line: 1261 - matches [^a] against 'aaAabcd '", () => { - const match = exec("[^a]", "aaAabcd ", "s"); + const match = exec("[^a]", "aaAabcd ", "ms"); expect(match.matches[0]).toBe("aaAabcd ".substring(2, 3)); }); it("line: 1262 - matches [^a] against 'aaaabcd'", () => { - const match = exec("[^a]", "aaaabcd", "is"); + const match = exec("[^a]", "aaaabcd", "mis"); expect(match.matches[0]).toBe("aaaabcd".substring(4, 5)); }); it("line: 1263 - matches [^a] against 'aaAabcd '", () => { - const match = exec("[^a]", "aaAabcd ", "is"); + const match = exec("[^a]", "aaAabcd ", "mis"); expect(match.matches[0]).toBe("aaAabcd ".substring(4, 5)); }); it("line: 1264 - matches [^az] against 'aaaabcd'", () => { - const match = exec("[^az]", "aaaabcd", "s"); + const match = exec("[^az]", "aaaabcd", "ms"); expect(match.matches[0]).toBe("aaaabcd".substring(4, 5)); }); it("line: 1265 - matches [^az] against 'aaAabcd '", () => { - const match = exec("[^az]", "aaAabcd ", "s"); + const match = exec("[^az]", "aaAabcd ", "ms"); expect(match.matches[0]).toBe("aaAabcd ".substring(2, 3)); }); it("line: 1266 - matches [^az] against 'aaaabcd'", () => { - const match = exec("[^az]", "aaaabcd", "is"); + const match = exec("[^az]", "aaaabcd", "mis"); expect(match.matches[0]).toBe("aaaabcd".substring(4, 5)); }); it("line: 1267 - matches [^az] against 'aaAabcd '", () => { - const match = exec("[^az]", "aaAabcd ", "is"); + const match = exec("[^az]", "aaAabcd ", "mis"); expect(match.matches[0]).toBe("aaAabcd ".substring(4, 5)); }); xit("line: 1268 - back references are not supported", () => {}); @@ -1776,7 +1808,7 @@ it("line: 1269 - matches P[^*]TAIRE[^*]{1,6}?LL against 'xxxxxxxxxxxPSTAIREISLLx const match = exec( "P[^*]TAIRE[^*]{1,6}?LL", "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx", - "s" + "ms" ); expect(match.matches[0]).toBe( "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx".substring(11, 22) @@ -1786,24 +1818,24 @@ it("line: 1270 - matches P[^*]TAIRE[^*]{1,}?LL against 'xxxxxxxxxxxPSTAIREISLLxx const match = exec( "P[^*]TAIRE[^*]{1,}?LL", "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx", - "s" + "ms" ); expect(match.matches[0]).toBe( "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx".substring(11, 22) ); }); it("line: 1271 - matches (\\.\\d\\d[1-9]?)\\d+ against '1.230003938'", () => { - const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.230003938", "s"); + const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.230003938", "ms"); expect(match.matches[0]).toBe("1.230003938".substring(1, 11)); expect(match.matches[1]).toBe("1.230003938".substring(1, 4)); }); it("line: 1272 - matches (\\.\\d\\d[1-9]?)\\d+ against '1.875000282 '", () => { - const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.875000282 ", "s"); + const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.875000282 ", "ms"); expect(match.matches[0]).toBe("1.875000282 ".substring(1, 11)); expect(match.matches[1]).toBe("1.875000282 ".substring(1, 5)); }); it("line: 1273 - matches (\\.\\d\\d[1-9]?)\\d+ against '1.235 '", () => { - const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.235 ", "s"); + const match = exec("(\\.\\d\\d[1-9]?)\\d+", "1.235 ", "ms"); expect(match.matches[0]).toBe("1.235 ".substring(1, 5)); expect(match.matches[1]).toBe("1.235 ".substring(1, 4)); }); @@ -1818,7 +1850,7 @@ it("line: 1281 - matches foo(.*)bar against 'The food is under the bar in the ba const match = exec( "foo(.*)bar", "The food is under the bar in the barn.", - "s" + "ms" ); expect(match.matches[0]).toBe( "The food is under the bar in the barn.".substring(4, 36) @@ -1831,7 +1863,7 @@ it("line: 1282 - matches foo(.*?)bar against 'The food is under the bar in the b const match = exec( "foo(.*?)bar", "The food is under the bar in the barn.", - "s" + "ms" ); expect(match.matches[0]).toBe( "The food is under the bar in the barn.".substring(4, 25) @@ -1841,31 +1873,31 @@ it("line: 1282 - matches foo(.*?)bar against 'The food is under the bar in the b ); }); it("line: 1283 - matches (.*)(\\d*) against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*)(\\d*)", "I have 2 numbers: 53147", "s"); + const match = exec("(.*)(\\d*)", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 23)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 23)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(23, 23)); }); it("line: 1284 - matches (.*)(\\d+) against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*)(\\d+)", "I have 2 numbers: 53147", "s"); + const match = exec("(.*)(\\d+)", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 23)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 22)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(22, 23)); }); it("line: 1285 - matches (.*?)(\\d*) against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*?)(\\d*)", "I have 2 numbers: 53147", "s"); + const match = exec("(.*?)(\\d*)", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 0)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 0)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(0, 0)); }); it("line: 1286 - matches (.*?)(\\d+) against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*?)(\\d+)", "I have 2 numbers: 53147", "s"); + const match = exec("(.*?)(\\d+)", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 8)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 7)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(7, 8)); }); it("line: 1287 - matches (.*)(\\d+)$ against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*)(\\d+)$", "I have 2 numbers: 53147", "s"); + const match = exec("(.*)(\\d+)$", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 23)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 22)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(22, 23)); @@ -1873,7 +1905,7 @@ it("line: 1287 - matches (.*)(\\d+)$ against 'I have 2 numbers: 53147'", () => { xit("line: 1288 - lazy quantifiers should still yield the longest overall regex match", () => {}); xit("line: 1289 - word boundary class not supported yet!", () => {}); it("line: 1290 - matches (.*\\D)(\\d+)$ against 'I have 2 numbers: 53147'", () => { - const match = exec("(.*\\D)(\\d+)$", "I have 2 numbers: 53147", "s"); + const match = exec("(.*\\D)(\\d+)$", "I have 2 numbers: 53147", "ms"); expect(match.matches[0]).toBe("I have 2 numbers: 53147".substring(0, 23)); expect(match.matches[1]).toBe("I have 2 numbers: 53147".substring(0, 18)); expect(match.matches[2]).toBe("I have 2 numbers: 53147".substring(18, 23)); @@ -1882,11 +1914,11 @@ xit("line: 1291 - non capturing groups not supported", () => {}); xit("line: 1292 - non capturing groups not supported", () => {}); xit("line: 1293 - non capturing groups not supported", () => {}); it("line: 1294 - matches ^[W-]46] against 'W46]789 '", () => { - const match = exec("^[W-]46]", "W46]789 ", "s"); + const match = exec("^[W-]46]", "W46]789 ", "ms"); expect(match.matches[0]).toBe("W46]789 ".substring(0, 4)); }); it("line: 1295 - matches ^[W-]46] against '-46]789'", () => { - const match = exec("^[W-]46]", "-46]789", "s"); + const match = exec("^[W-]46]", "-46]789", "ms"); expect(match.matches[0]).toBe("-46]789".substring(0, 4)); }); it("line: 1296 - matches ^[W-]46] against 'Wall'", () => { @@ -1904,107 +1936,107 @@ it("line: 1299 - matches ^[W-]46] against '[abcd] '", () => { it("line: 1300 - matches ^[W-]46] against ']abcd['", () => { expectNotMatch("^[W-]46]", ["]abcd["]); }); -xit("line: 1301 - requires triage", () => {}); -xit("line: 1302 - requires triage", () => {}); -xit("line: 1303 - requires triage", () => {}); -xit("line: 1304 - requires triage", () => {}); -xit("line: 1305 - requires triage", () => {}); -xit("line: 1306 - requires triage", () => {}); -xit("line: 1307 - requires triage", () => {}); -xit("line: 1308 - requires triage", () => {}); +xit("line: 1301 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1302 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1303 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1304 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1305 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1306 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1307 - does nto support escaped characters in character ranges", () => {}); +xit("line: 1308 - does nto support escaped characters in character ranges", () => {}); it("line: 1309 - matches ^[W-\\]46] against '-46]789'", () => { expectNotMatch("^[W-\\]46]", ["-46]789"]); }); it("line: 1310 - matches ^[W-\\]46] against 'well'", () => { expectNotMatch("^[W-\\]46]", ["well"]); }); -it("line: 1311 - matches \\d\\d/\\d\\d/\\d\\d\\d\\d against '01/01/2000'", () => { - const match = exec("\\d\\d/\\d\\d/\\d\\d\\d\\d", "01/01/2000", "s"); +it("line: 1311 - matches \\d\\d\\/\\d\\d\\/\\d\\d\\d\\d against '01/01/2000'", () => { + const match = exec("\\d\\d\\/\\d\\d\\/\\d\\d\\d\\d", "01/01/2000", "ms"); expect(match.matches[0]).toBe("01/01/2000".substring(0, 10)); }); xit("line: 1312 - non capturing groups not supported", () => {}); xit("line: 1313 - non capturing groups not supported", () => {}); xit("line: 1314 - non capturing groups not supported", () => {}); it("line: 1315 - matches ^(a){0,0} against 'bcd'", () => { - const match = exec("^(a){0,0}", "bcd", "s"); + const match = exec("^(a){0,0}", "bcd", "ms"); expect(match.matches[0]).toBe("bcd".substring(0, 0)); }); it("line: 1316 - matches ^(a){0,0} against 'abc'", () => { - const match = exec("^(a){0,0}", "abc", "s"); + const match = exec("^(a){0,0}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 0)); }); it("line: 1317 - matches ^(a){0,0} against 'aab '", () => { - const match = exec("^(a){0,0}", "aab ", "s"); + const match = exec("^(a){0,0}", "aab ", "ms"); expect(match.matches[0]).toBe("aab ".substring(0, 0)); }); it("line: 1318 - matches ^(a){0,1} against 'bcd'", () => { - const match = exec("^(a){0,1}", "bcd", "s"); + const match = exec("^(a){0,1}", "bcd", "ms"); expect(match.matches[0]).toBe("bcd".substring(0, 0)); }); it("line: 1319 - matches ^(a){0,1} against 'abc'", () => { - const match = exec("^(a){0,1}", "abc", "s"); + const match = exec("^(a){0,1}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1320 - matches ^(a){0,1} against 'aab '", () => { - const match = exec("^(a){0,1}", "aab ", "s"); + const match = exec("^(a){0,1}", "aab ", "ms"); expect(match.matches[0]).toBe("aab ".substring(0, 1)); expect(match.matches[1]).toBe("aab ".substring(0, 1)); }); it("line: 1321 - matches ^(a){0,2} against 'bcd'", () => { - const match = exec("^(a){0,2}", "bcd", "s"); + const match = exec("^(a){0,2}", "bcd", "ms"); expect(match.matches[0]).toBe("bcd".substring(0, 0)); }); it("line: 1322 - matches ^(a){0,2} against 'abc'", () => { - const match = exec("^(a){0,2}", "abc", "s"); + const match = exec("^(a){0,2}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1323 - matches ^(a){0,2} against 'aab '", () => { - const match = exec("^(a){0,2}", "aab ", "s"); + const match = exec("^(a){0,2}", "aab ", "ms"); expect(match.matches[0]).toBe("aab ".substring(0, 2)); expect(match.matches[1]).toBe("aab ".substring(1, 2)); }); it("line: 1324 - matches ^(a){0,3} against 'bcd'", () => { - const match = exec("^(a){0,3}", "bcd", "s"); + const match = exec("^(a){0,3}", "bcd", "ms"); expect(match.matches[0]).toBe("bcd".substring(0, 0)); }); it("line: 1325 - matches ^(a){0,3} against 'abc'", () => { - const match = exec("^(a){0,3}", "abc", "s"); + const match = exec("^(a){0,3}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1326 - matches ^(a){0,3} against 'aab'", () => { - const match = exec("^(a){0,3}", "aab", "s"); + const match = exec("^(a){0,3}", "aab", "ms"); expect(match.matches[0]).toBe("aab".substring(0, 2)); expect(match.matches[1]).toBe("aab".substring(1, 2)); }); it("line: 1327 - matches ^(a){0,3} against 'aaa '", () => { - const match = exec("^(a){0,3}", "aaa ", "s"); + const match = exec("^(a){0,3}", "aaa ", "ms"); expect(match.matches[0]).toBe("aaa ".substring(0, 3)); expect(match.matches[1]).toBe("aaa ".substring(2, 3)); }); it("line: 1328 - matches ^(a){0,} against 'bcd'", () => { - const match = exec("^(a){0,}", "bcd", "s"); + const match = exec("^(a){0,}", "bcd", "ms"); expect(match.matches[0]).toBe("bcd".substring(0, 0)); }); it("line: 1329 - matches ^(a){0,} against 'abc'", () => { - const match = exec("^(a){0,}", "abc", "s"); + const match = exec("^(a){0,}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1330 - matches ^(a){0,} against 'aab'", () => { - const match = exec("^(a){0,}", "aab", "s"); + const match = exec("^(a){0,}", "aab", "ms"); expect(match.matches[0]).toBe("aab".substring(0, 2)); expect(match.matches[1]).toBe("aab".substring(1, 2)); }); it("line: 1331 - matches ^(a){0,} against 'aaa'", () => { - const match = exec("^(a){0,}", "aaa", "s"); + const match = exec("^(a){0,}", "aaa", "ms"); expect(match.matches[0]).toBe("aaa".substring(0, 3)); expect(match.matches[1]).toBe("aaa".substring(2, 3)); }); it("line: 1332 - matches ^(a){0,} against 'aaaaaaaa '", () => { - const match = exec("^(a){0,}", "aaaaaaaa ", "s"); + const match = exec("^(a){0,}", "aaaaaaaa ", "ms"); expect(match.matches[0]).toBe("aaaaaaaa ".substring(0, 8)); expect(match.matches[1]).toBe("aaaaaaaa ".substring(7, 8)); }); @@ -2012,12 +2044,12 @@ it("line: 1333 - matches ^(a){1,1} against 'bcd'", () => { expectNotMatch("^(a){1,1}", ["bcd"]); }); it("line: 1334 - matches ^(a){1,1} against 'abc'", () => { - const match = exec("^(a){1,1}", "abc", "s"); + const match = exec("^(a){1,1}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1335 - matches ^(a){1,1} against 'aab '", () => { - const match = exec("^(a){1,1}", "aab ", "s"); + const match = exec("^(a){1,1}", "aab ", "ms"); expect(match.matches[0]).toBe("aab ".substring(0, 1)); expect(match.matches[1]).toBe("aab ".substring(0, 1)); }); @@ -2025,12 +2057,12 @@ it("line: 1336 - matches ^(a){1,2} against 'bcd'", () => { expectNotMatch("^(a){1,2}", ["bcd"]); }); it("line: 1337 - matches ^(a){1,2} against 'abc'", () => { - const match = exec("^(a){1,2}", "abc", "s"); + const match = exec("^(a){1,2}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1338 - matches ^(a){1,2} against 'aab '", () => { - const match = exec("^(a){1,2}", "aab ", "s"); + const match = exec("^(a){1,2}", "aab ", "ms"); expect(match.matches[0]).toBe("aab ".substring(0, 2)); expect(match.matches[1]).toBe("aab ".substring(1, 2)); }); @@ -2038,17 +2070,17 @@ it("line: 1339 - matches ^(a){1,3} against 'bcd'", () => { expectNotMatch("^(a){1,3}", ["bcd"]); }); it("line: 1340 - matches ^(a){1,3} against 'abc'", () => { - const match = exec("^(a){1,3}", "abc", "s"); + const match = exec("^(a){1,3}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1341 - matches ^(a){1,3} against 'aab'", () => { - const match = exec("^(a){1,3}", "aab", "s"); + const match = exec("^(a){1,3}", "aab", "ms"); expect(match.matches[0]).toBe("aab".substring(0, 2)); expect(match.matches[1]).toBe("aab".substring(1, 2)); }); it("line: 1342 - matches ^(a){1,3} against 'aaa '", () => { - const match = exec("^(a){1,3}", "aaa ", "s"); + const match = exec("^(a){1,3}", "aaa ", "ms"); expect(match.matches[0]).toBe("aaa ".substring(0, 3)); expect(match.matches[1]).toBe("aaa ".substring(2, 3)); }); @@ -2056,87 +2088,129 @@ it("line: 1343 - matches ^(a){1,} against 'bcd'", () => { expectNotMatch("^(a){1,}", ["bcd"]); }); it("line: 1344 - matches ^(a){1,} against 'abc'", () => { - const match = exec("^(a){1,}", "abc", "s"); + const match = exec("^(a){1,}", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 1)); expect(match.matches[1]).toBe("abc".substring(0, 1)); }); it("line: 1345 - matches ^(a){1,} against 'aab'", () => { - const match = exec("^(a){1,}", "aab", "s"); + const match = exec("^(a){1,}", "aab", "ms"); expect(match.matches[0]).toBe("aab".substring(0, 2)); expect(match.matches[1]).toBe("aab".substring(1, 2)); }); it("line: 1346 - matches ^(a){1,} against 'aaa'", () => { - const match = exec("^(a){1,}", "aaa", "s"); + const match = exec("^(a){1,}", "aaa", "ms"); expect(match.matches[0]).toBe("aaa".substring(0, 3)); expect(match.matches[1]).toBe("aaa".substring(2, 3)); }); it("line: 1347 - matches ^(a){1,} against 'aaaaaaaa '", () => { - const match = exec("^(a){1,}", "aaaaaaaa ", "s"); + const match = exec("^(a){1,}", "aaaaaaaa ", "ms"); expect(match.matches[0]).toBe("aaaaaaaa ".substring(0, 8)); expect(match.matches[1]).toBe("aaaaaaaa ".substring(7, 8)); }); it("line: 1348 - matches .{0,}\\.gif against 'borfle\nbib.gif\nno'", () => { - const match = exec(".{0,}\\.gif", "borfle\nbib.gif\nno", "s"); + const match = exec(".{0,}\\.gif", "borfle\nbib.gif\nno", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 14)); }); it("line: 1349 - matches .*\\.gif against 'borfle\nbib.gif\nno'", () => { - const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "s"); + const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 14)); }); -xit("line: 1350 - multi line regex not supported yet!", () => {}); +it("line: 1350 - matches .*\\.gif against 'borfle\nbib.gif\nno'", () => { + const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "m"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(7, 14)); +}); it("line: 1351 - matches .*\\.gif against 'borfle\nbib.gif\nno'", () => { - const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "s"); + const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "ms"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 14)); +}); +it("line: 1352 - matches .*\\.gif against 'borfle\nbib.gif\nno'", () => { + const match = exec(".*\\.gif", "borfle\nbib.gif\nno", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 14)); }); -xit("line: 1352 - multi line regex not supported yet!", () => {}); it("line: 1353 - matches .*$ against 'borfle\nbib.gif\nno'", () => { - const match = exec(".*$", "borfle\nbib.gif\nno", "s"); + const match = exec(".*$", "borfle\nbib.gif\nno", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 17)); }); -xit("line: 1354 - multi line regex not supported yet!", () => {}); +it("line: 1354 - matches .*$ against 'borfle\nbib.gif\nno'", () => { + const match = exec(".*$", "borfle\nbib.gif\nno", "m"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 6)); +}); it("line: 1355 - matches .*$ against 'borfle\nbib.gif\nno'", () => { - const match = exec(".*$", "borfle\nbib.gif\nno", "s"); + const match = exec(".*$", "borfle\nbib.gif\nno", "ms"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 17)); +}); +it("line: 1356 - matches .*$ against 'borfle\nbib.gif\nno'", () => { + const match = exec(".*$", "borfle\nbib.gif\nno", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno".substring(0, 17)); }); -xit("line: 1356 - multi line regex not supported yet!", () => {}); it("line: 1357 - matches .*$ against 'borfle\nbib.gif\nno\n'", () => { - const match = exec(".*$", "borfle\nbib.gif\nno\n", "s"); + const match = exec(".*$", "borfle\nbib.gif\nno\n", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno\n".substring(0, 18)); }); -xit("line: 1358 - multi line regex not supported yet!", () => {}); +it("line: 1358 - matches .*$ against 'borfle\nbib.gif\nno\n'", () => { + const match = exec(".*$", "borfle\nbib.gif\nno\n", "m"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno\n".substring(0, 6)); +}); it("line: 1359 - matches .*$ against 'borfle\nbib.gif\nno\n'", () => { - const match = exec(".*$", "borfle\nbib.gif\nno\n", "s"); + const match = exec(".*$", "borfle\nbib.gif\nno\n", "ms"); + expect(match.matches[0]).toBe("borfle\nbib.gif\nno\n".substring(0, 18)); +}); +it("line: 1360 - matches .*$ against 'borfle\nbib.gif\nno\n'", () => { + const match = exec(".*$", "borfle\nbib.gif\nno\n", "ms"); expect(match.matches[0]).toBe("borfle\nbib.gif\nno\n".substring(0, 18)); }); -xit("line: 1360 - multi line regex not supported yet!", () => {}); it("line: 1361 - matches (.*X|^B) against 'abcde\n1234Xyz'", () => { - const match = exec("(.*X|^B)", "abcde\n1234Xyz", "s"); + const match = exec("(.*X|^B)", "abcde\n1234Xyz", "ms"); expect(match.matches[0]).toBe("abcde\n1234Xyz".substring(0, 11)); expect(match.matches[1]).toBe("abcde\n1234Xyz".substring(0, 11)); }); it("line: 1362 - matches (.*X|^B) against 'BarFoo '", () => { - const match = exec("(.*X|^B)", "BarFoo ", "s"); + const match = exec("(.*X|^B)", "BarFoo ", "ms"); + expect(match.matches[0]).toBe("BarFoo ".substring(0, 1)); + expect(match.matches[1]).toBe("BarFoo ".substring(0, 1)); +}); +xit("line: 1363 - does not support start of string quantified within an alternation", () => {}); +it("line: 1364 - matches (.*X|^B) against 'abcde\n1234Xyz'", () => { + const match = exec("(.*X|^B)", "abcde\n1234Xyz", "m"); + expect(match.matches[0]).toBe("abcde\n1234Xyz".substring(6, 11)); + expect(match.matches[1]).toBe("abcde\n1234Xyz".substring(6, 11)); +}); +it("line: 1365 - matches (.*X|^B) against 'BarFoo '", () => { + const match = exec("(.*X|^B)", "BarFoo ", "m"); expect(match.matches[0]).toBe("BarFoo ".substring(0, 1)); expect(match.matches[1]).toBe("BarFoo ".substring(0, 1)); }); -xit("line: 1363 - requires triage", () => {}); -xit("line: 1364 - multi line regex not supported yet!", () => {}); -xit("line: 1365 - multi line regex not supported yet!", () => {}); -xit("line: 1366 - multi line regex not supported yet!", () => {}); +it("line: 1366 - matches (.*X|^B) against 'abcde\nBar '", () => { + const match = exec("(.*X|^B)", "abcde\nBar ", "m"); + expect(match.matches[0]).toBe("abcde\nBar ".substring(6, 7)); + expect(match.matches[1]).toBe("abcde\nBar ".substring(6, 7)); +}); it("line: 1367 - matches (.*X|^B) against 'abcde\n1234Xyz'", () => { - const match = exec("(.*X|^B)", "abcde\n1234Xyz", "s"); + const match = exec("(.*X|^B)", "abcde\n1234Xyz", "ms"); expect(match.matches[0]).toBe("abcde\n1234Xyz".substring(0, 11)); expect(match.matches[1]).toBe("abcde\n1234Xyz".substring(0, 11)); }); it("line: 1368 - matches (.*X|^B) against 'BarFoo '", () => { - const match = exec("(.*X|^B)", "BarFoo ", "s"); + const match = exec("(.*X|^B)", "BarFoo ", "ms"); + expect(match.matches[0]).toBe("BarFoo ".substring(0, 1)); + expect(match.matches[1]).toBe("BarFoo ".substring(0, 1)); +}); +xit("line: 1369 - does not support start of string quantified within an alternation", () => {}); +it("line: 1370 - matches (.*X|^B) against 'abcde\n1234Xyz'", () => { + const match = exec("(.*X|^B)", "abcde\n1234Xyz", "ms"); + expect(match.matches[0]).toBe("abcde\n1234Xyz".substring(0, 11)); + expect(match.matches[1]).toBe("abcde\n1234Xyz".substring(0, 11)); +}); +it("line: 1371 - matches (.*X|^B) against 'BarFoo '", () => { + const match = exec("(.*X|^B)", "BarFoo ", "ms"); expect(match.matches[0]).toBe("BarFoo ".substring(0, 1)); expect(match.matches[1]).toBe("BarFoo ".substring(0, 1)); }); -xit("line: 1369 - requires triage", () => {}); -xit("line: 1370 - multi line regex not supported yet!", () => {}); -xit("line: 1371 - multi line regex not supported yet!", () => {}); -xit("line: 1372 - multi line regex not supported yet!", () => {}); +it("line: 1372 - matches (.*X|^B) against 'abcde\nBar '", () => { + const match = exec("(.*X|^B)", "abcde\nBar ", "ms"); + expect(match.matches[0]).toBe("abcde\nBar ".substring(6, 7)); + expect(match.matches[1]).toBe("abcde\nBar ".substring(6, 7)); +}); xit("line: 1373 - non capturing groups not supported", () => {}); xit("line: 1374 - non capturing groups not supported", () => {}); xit("line: 1375 - non capturing groups not supported", () => {}); @@ -2144,10 +2218,13 @@ xit("line: 1376 - non capturing groups not supported", () => {}); xit("line: 1377 - non capturing groups not supported", () => {}); xit("line: 1378 - non capturing groups not supported", () => {}); it("line: 1379 - matches ^.*B against 'abc\nB'", () => { - const match = exec("^.*B", "abc\nB", "s"); + const match = exec("^.*B", "abc\nB", "ms"); expect(match.matches[0]).toBe("abc\nB".substring(0, 5)); }); -xit("line: 1380 - multi line regex not supported yet!", () => {}); +it("line: 1380 - matches ^.*B against 'abc\nB'", () => { + const match = exec("^.*B", "abc\nB", "m"); + expect(match.matches[0]).toBe("abc\nB".substring(4, 5)); +}); xit("line: 1381 - non capturing groups not supported", () => {}); xit("line: 1382 - non capturing groups not supported", () => {}); xit("line: 1383 - non capturing groups not supported", () => {}); @@ -2158,7 +2235,7 @@ it("line: 1387 - matches ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9 const match = exec( "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]", "123456654321", - "s" + "ms" ); expect(match.matches[0]).toBe("123456654321".substring(0, 12)); }); @@ -2166,7 +2243,7 @@ it("line: 1388 - matches ^\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d against '12345665 const match = exec( "^\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d", "123456654321 ", - "s" + "ms" ); expect(match.matches[0]).toBe("123456654321 ".substring(0, 12)); }); @@ -2174,63 +2251,63 @@ it("line: 1389 - matches ^[\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d const match = exec( "^[\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d]", "123456654321", - "s" + "ms" ); expect(match.matches[0]).toBe("123456654321".substring(0, 12)); }); it("line: 1390 - matches ^[abc]{12} against 'abcabcabcabc'", () => { - const match = exec("^[abc]{12}", "abcabcabcabc", "s"); + const match = exec("^[abc]{12}", "abcabcabcabc", "ms"); expect(match.matches[0]).toBe("abcabcabcabc".substring(0, 12)); }); it("line: 1391 - matches ^[a-c]{12} against 'abcabcabcabc'", () => { - const match = exec("^[a-c]{12}", "abcabcabcabc", "s"); + const match = exec("^[a-c]{12}", "abcabcabcabc", "ms"); expect(match.matches[0]).toBe("abcabcabcabc".substring(0, 12)); }); it("line: 1392 - matches ^(a|b|c){12} against 'abcabcabcabc '", () => { - const match = exec("^(a|b|c){12}", "abcabcabcabc ", "s"); + const match = exec("^(a|b|c){12}", "abcabcabcabc ", "ms"); expect(match.matches[0]).toBe("abcabcabcabc ".substring(0, 12)); expect(match.matches[1]).toBe("abcabcabcabc ".substring(11, 12)); }); it("line: 1393 - matches ^[abcdefghijklmnopqrstuvwxy0123456789] against 'n'", () => { - const match = exec("^[abcdefghijklmnopqrstuvwxy0123456789]", "n", "s"); + const match = exec("^[abcdefghijklmnopqrstuvwxy0123456789]", "n", "ms"); expect(match.matches[0]).toBe("n".substring(0, 1)); }); it("line: 1394 - matches ^[abcdefghijklmnopqrstuvwxy0123456789] against 'z '", () => { expectNotMatch("^[abcdefghijklmnopqrstuvwxy0123456789]", ["z "]); }); it("line: 1395 - matches abcde{0,0} against 'abcd'", () => { - const match = exec("abcde{0,0}", "abcd", "s"); + const match = exec("abcde{0,0}", "abcd", "ms"); expect(match.matches[0]).toBe("abcd".substring(0, 4)); }); it("line: 1396 - matches abcde{0,0} against 'abce '", () => { expectNotMatch("abcde{0,0}", ["abce "]); }); it("line: 1397 - matches ab[cd]{0,0}e against 'abe'", () => { - const match = exec("ab[cd]{0,0}e", "abe", "s"); + const match = exec("ab[cd]{0,0}e", "abe", "ms"); expect(match.matches[0]).toBe("abe".substring(0, 3)); }); it("line: 1398 - matches ab[cd]{0,0}e against 'abcde '", () => { expectNotMatch("ab[cd]{0,0}e", ["abcde "]); }); it("line: 1399 - matches ab(c){0,0}d against 'abd'", () => { - const match = exec("ab(c){0,0}d", "abd", "s"); + const match = exec("ab(c){0,0}d", "abd", "ms"); expect(match.matches[0]).toBe("abd".substring(0, 3)); }); it("line: 1400 - matches ab(c){0,0}d against 'abcd '", () => { expectNotMatch("ab(c){0,0}d", ["abcd "]); }); it("line: 1401 - matches a(b*) against 'a'", () => { - const match = exec("a(b*)", "a", "s"); + const match = exec("a(b*)", "a", "ms"); expect(match.matches[0]).toBe("a".substring(0, 1)); expect(match.matches[1]).toBe("a".substring(1, 1)); }); it("line: 1402 - matches a(b*) against 'ab'", () => { - const match = exec("a(b*)", "ab", "s"); + const match = exec("a(b*)", "ab", "ms"); expect(match.matches[0]).toBe("ab".substring(0, 2)); expect(match.matches[1]).toBe("ab".substring(1, 2)); }); it("line: 1403 - matches a(b*) against 'abbbb'", () => { - const match = exec("a(b*)", "abbbb", "s"); + const match = exec("a(b*)", "abbbb", "ms"); expect(match.matches[0]).toBe("abbbb".substring(0, 5)); expect(match.matches[1]).toBe("abbbb".substring(1, 5)); }); @@ -2238,14 +2315,14 @@ it("line: 1404 - matches a(b*) against 'bbbbb '", () => { expectNotMatch("a(b*)", ["bbbbb "]); }); it("line: 1405 - matches ab\\d{0}e against 'abe'", () => { - const match = exec("ab\\d{0}e", "abe", "s"); + const match = exec("ab\\d{0}e", "abe", "ms"); expect(match.matches[0]).toBe("abe".substring(0, 3)); }); it("line: 1406 - matches ab\\d{0}e against 'ab1e '", () => { expectNotMatch("ab\\d{0}e", ["ab1e "]); }); it('line: 1407 - matches "([^\\\\"]+|\\\\.)*" against \'the "quick" brown fox\'', () => { - const match = exec('"([^\\\\"]+|\\\\.)*"', 'the "quick" brown fox', "s"); + const match = exec('"([^\\\\"]+|\\\\.)*"', 'the "quick" brown fox', "ms"); expect(match.matches[0]).toBe('the "quick" brown fox'.substring(4, 11)); expect(match.matches[1]).toBe('the "quick" brown fox'.substring(5, 10)); }); @@ -2253,7 +2330,7 @@ it('line: 1408 - matches "([^\\\\"]+|\\\\.)*" against \'"the \\"quick\\" brown f const match = exec( '"([^\\\\"]+|\\\\.)*"', '"the \\"quick\\" brown fox" ', - "s" + "ms" ); expect(match.matches[0]).toBe( '"the \\"quick\\" brown fox" '.substring(0, 25) @@ -2263,45 +2340,117 @@ it('line: 1408 - matches "([^\\\\"]+|\\\\.)*" against \'"the \\"quick\\" brown f ); }); it("line: 1409 - matches .*? against 'abc'", () => { - const match = exec(".*?", "abc", "s"); + const match = exec(".*?", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 0)); }); xit("line: 1410 - word boundary class not supported yet!", () => {}); xit("line: 1411 - word boundary class not supported yet!", () => {}); it("line: 1412 - matches against 'abc'", () => { - const match = exec("", "abc", "s"); + const match = exec("", "abc", "ms"); expect(match.matches[0]).toBe("abc".substring(0, 0)); }); -xit("line: 1413 - requires triage", () => {}); +it("line: 1413 - matches ]{0,})>]{0,})>([\\d]{0,}\\.)(.*)((
([\\w\\W\\s\\d][^<>]{0,})|[\\s]{0,}))<\\/a><\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD><\\/TR> against '43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide'", () => { + const match = exec( + "]{0,})>]{0,})>([\\d]{0,}\\.)(.*)((
([\\w\\W\\s\\d][^<>]{0,})|[\\s]{0,}))<\\/a><\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD><\\/TR>", + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide", + "mis" + ); + expect(match.matches[0]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 0, + 227 + ) + ); + expect(match.matches[1]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 3, + 21 + ) + ); + expect(match.matches[2]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 25, + 47 + ) + ); + expect(match.matches[3]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 48, + 51 + ) + ); + expect(match.matches[4]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 51, + 122 + ) + ); + expect(match.matches[5]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 122, + 122 + ) + ); + expect(match.matches[6]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 122, + 122 + ) + ); + expect(match.matches[8]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 134, + 156 + ) + ); + expect(match.matches[9]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 157, + 172 + ) + ); + expect(match.matches[10]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 180, + 202 + ) + ); + expect(match.matches[11]).toBe( + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide".substring( + 203, + 217 + ) + ); +}); it("line: 1414 - matches a[^a]b against 'acb'", () => { - const match = exec("a[^a]b", "acb", "s"); + const match = exec("a[^a]b", "acb", "ms"); expect(match.matches[0]).toBe("acb".substring(0, 3)); }); it("line: 1415 - matches a[^a]b against 'a\nb'", () => { - const match = exec("a[^a]b", "a\nb", "s"); + const match = exec("a[^a]b", "a\nb", "ms"); expect(match.matches[0]).toBe("a\nb".substring(0, 3)); }); it("line: 1416 - matches a.b against 'acb'", () => { - const match = exec("a.b", "acb", "s"); + const match = exec("a.b", "acb", "ms"); expect(match.matches[0]).toBe("acb".substring(0, 3)); }); it("line: 1417 - matches a.b against 'a\nb '", () => { - const match = exec("a.b", "a\nb ", "s"); + const match = exec("a.b", "a\nb ", "ms"); expect(match.matches[0]).toBe("a\nb ".substring(0, 3)); }); it("line: 1418 - matches a[^a]b against 'acb'", () => { - const match = exec("a[^a]b", "acb", "s"); + const match = exec("a[^a]b", "acb", "ms"); expect(match.matches[0]).toBe("acb".substring(0, 3)); }); it("line: 1419 - matches a[^a]b against 'a\nb '", () => { - const match = exec("a[^a]b", "a\nb ", "s"); + const match = exec("a[^a]b", "a\nb ", "ms"); expect(match.matches[0]).toBe("a\nb ".substring(0, 3)); }); it("line: 1420 - matches a.b against 'acb'", () => { - const match = exec("a.b", "acb", "s"); + const match = exec("a.b", "acb", "ms"); expect(match.matches[0]).toBe("acb".substring(0, 3)); }); it("line: 1421 - matches a.b against 'a\nb '", () => { - const match = exec("a.b", "a\nb ", "s"); + const match = exec("a.b", "a\nb ", "ms"); expect(match.matches[0]).toBe("a\nb ".substring(0, 3)); }); diff --git a/assembly/__tests__/regex.spec.ts b/assembly/__tests__/regex.spec.ts index 1ac864f..691caed 100644 --- a/assembly/__tests__/regex.spec.ts +++ b/assembly/__tests__/regex.spec.ts @@ -69,6 +69,58 @@ describe("global mode", () => { }); }); +describe("multi-line mode", () => { + it("sets multi-line flag", () => { + expect(new RegExp("\\d+", "m").multiline).toBeTruthy(); + expect(new RegExp("\\d+", "").multiline).toBeFalsy(); + }); + + it("matches across multiple lines", () => { + const match = exec("^f\\d{1}$", "f1\nbar\nbaz\nf2", "m"); + expect(match.matches.length).toBe(1); + expect(match.matches[0]).toBe("f1"); + }); + + it("matches across multiple lines with global mode", () => { + const regex = new RegExp("^f\\d{1}$", "gm"); + + let match = regex.exec("f1\nbar\nbaz\nf2"); + expect(match!.matches[0]).toBe("f1"); + + match = regex.exec("f1\nbar\nbaz\nf2"); + expect(match!.matches[0]).toBe("f2"); + + match = regex.exec("f1\nbar\nbaz\nf2"); + expect(match).toBeNull(); + }); + + it("matches across multiple lines with global mode", () => { + const regex = new RegExp("^[a-c]", "gm"); + + let match = regex.exec("a1\nd2\nc3\n"); + expect(match!.matches[0]).toBe("a"); + + match = regex.exec("a1\nd2\nc3\n"); + expect(match!.matches[0]).toBe("c"); + + match = regex.exec("a1\nd2\nc3\n"); + expect(match).toBeNull(); + }); + + it("matches across multiple lines with global mode", () => { + const regex = new RegExp("[a-c]$", "gm"); + + let match = regex.exec("1a\n2d\n3c\n"); + expect(match!.matches[0]).toBe("a"); + + match = regex.exec("1a\n2d\n3c\n"); + expect(match!.matches[0]).toBe("c"); + + match = regex.exec("1a\n2d\n3c\n"); + expect(match).toBeNull(); + }); +}); + describe("non-global mode", () => { it("doesn't increment lastIndex", () => { const regex = new RegExp("\\d+"); diff --git a/assembly/char.ts b/assembly/char.ts index 1d1d0f9..4a78d49 100644 --- a/assembly/char.ts +++ b/assembly/char.ts @@ -1,10 +1,10 @@ export const enum Char { None = -1, HorizontalTab = 0x09, + LineFeed = 0x0a, VerticalTab = 0x0b, FormFeed = 0x0c, CarriageReturn = 0x0d, - LineFeed = 0x0a, Space = 0x20, Dollar = 0x24, // "$" LeftParenthesis = 0x28, diff --git a/assembly/nfa/matcher.ts b/assembly/nfa/matcher.ts index b739bc4..5758c8e 100644 --- a/assembly/nfa/matcher.ts +++ b/assembly/nfa/matcher.ts @@ -118,7 +118,7 @@ export class CharacterRangeMatcher extends Matcher { matches(code: u32): bool { for (let i = 0, len = this.ranges.length; i < len; i++) { - if (code >= u32(this.ranges[i].from) && code <= u32(this.ranges[i].to)) { + if (this.ranges[i].contains(code)) { return true; } } diff --git a/assembly/regexp.ts b/assembly/regexp.ts index 51a5506..8004736 100644 --- a/assembly/regexp.ts +++ b/assembly/regexp.ts @@ -75,12 +75,14 @@ export class Flags { global: bool = false; ignoreCase: bool = false; dotAll: bool = false; + multiline: bool = false; constructor(flagString: string | null) { if (flagString) { this.global = flagString.includes("g"); this.ignoreCase = flagString.includes("i"); this.dotAll = flagString.includes("s"); + this.multiline = flagString.includes("m"); } } } @@ -159,9 +161,10 @@ export class RegExp { } // search for a match at each index within the string + for ( let matchIndex = this.lastIndex; - matchIndex < (this.startOfInput ? 1 : len); + matchIndex < (this.startOfInput && !this.multiline ? 1 : len); matchIndex++ ) { // search for a match in this substring @@ -185,14 +188,32 @@ export class RegExp { // return this match (checking end of input condition) const matchEndIndex = match.index + match.matches[0].length; - if (!this.endOfInput || (this.endOfInput && matchEndIndex == len)) { - if (this.global) { - this.lastIndex = matchEndIndex; + + // has the start of input criteria been met? + if (this.startOfInput) { + if (this.flags.multiline && matchIndex != 0) { + if (str.charCodeAt(matchIndex - 1) != Char.LineFeed) continue; + } else if (matchIndex != 0) { + continue; + } + } + + // has the enf of input criteria been met? + if (this.endOfInput) { + if (this.flags.multiline && matchEndIndex != len) { + if (str.charCodeAt(matchEndIndex) != Char.LineFeed) continue; + } else if (matchEndIndex != len) { + continue; } - return match; } + + if (this.global) { + this.lastIndex = matchEndIndex; + } + return match; } } + this.lastIndex = 0; return null; } @@ -216,6 +237,10 @@ export class RegExp { get dotAll(): bool { return this.flags.dotAll; } + + get multiline(): bool { + return this.flags.multiline; + } } // TODO: do we need this factory function, or can we invoke diff --git a/assembly/util.ts b/assembly/util.ts index 9215e04..917de56 100644 --- a/assembly/util.ts +++ b/assembly/util.ts @@ -24,4 +24,8 @@ export class Range { offset(value: i32): Range { return new Range(this.from + value, this.to + value); } + + contains(value: i32): bool { + return value >= this.from && value <= this.to; + } } diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index 3808d28..af8149b 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -54,6 +54,13 @@ suite "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; executeRegex("[a-l]{3}", text, true); }) + .add("complex regex", () => { + const text = + "43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide"; + const regex = + "]{0,})>]{0,})>([\\d]{0,}\\.)(.*)((
([\\w\\W\\s\\d][^<>]{0,})|[\\s]{0,}))<\\/a><\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD>]{0,})>([\\w\\W\\s\\d][^<>]{0,})<\\/TD><\\/TR>"; + executeRegex(regex, text, true); + }) // add listeners .on("cycle", (event) => { console.log(String(event.target)); diff --git a/spec/test-generator.js b/spec/test-generator.js index dfc32eb..2ebd861 100644 --- a/spec/test-generator.js +++ b/spec/test-generator.js @@ -9,36 +9,45 @@ const range = (from, to) => Array.from({ length: to - from + 1 }, (_, i) => i + from); const knownIssues = { + /* ------- features not yet implemented ------- */ + "does not support start of string quantified within an alternation": [ + 1363, + 1369, + ], + "does not support hex notification in character sets": [...range(1147, 1149)], + "does nto support escaped characters in character ranges": [ + ...range(1301, 1308), + ], + "lazy quantifiers should still yield the longest overall regex match": [ + ...range(141, 143), + 1288, + ], + + /* -------- issues with the tests ------------ */ + "test appears to be incorrect?": [203, 204], "issue with parsing the test itself": [ 1103, - ...range(1185, 1188), ...range(1095, 1098), ...range(487, 494), ...range(1077, 1082), ], - "lazy quantifiers should still yield the longest overall regex match": [ - ...range(141, 143), - 1288, - ], "test contains an octal escape sequence": [1102], // the test results measure captured groups using character length / locations // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length // this is tricky to reproduce - "test requires a substring function": [1087], - "requires triage": [ - 1363, - 1369, + "test requires a substring function": [1087, 1088], + + /* -------- differences between PCRE and JS regex ------------ */ + "test indicates a malformed regex, whereas it appears OK in JS": [ + 1189, + ...range(1186, 1188), + ], + "JS does not support the \\A \\Z syntax for start and end of string": [ 1163, - 1088, - 1239, - ...range(1147, 1149), - 1413, - ...range(1301, 1308), + 1164, ], - "test indicates a malformed regex, whereas it appears OK in JS": [1189], "test regex contains syntax not supported in JS": [82, 1158, 281], "the test behaviour differs between PCRE and JS": [290], - "test appears to be incorrect?": [203, 204], }; const hasKnownIssue = (index) => { @@ -81,14 +90,13 @@ lines.forEach((line, index) => { regex = parts[1] == "SAME" ? regex - : escapeQuote(parts[1] == "NULL" ? "" : parts[1]); + : escapeQuote(parts[1] == "NULL" ? "" : parts[1]).replaceAll( + "/", + "\\\\/" + ); let str = parts[2] !== "NULL" ? escapeQuote(parts[2]) : ""; - let flags = parts[0].includes("i") ? "is" : "s"; - - if (parts[0].includes("n")) { - testCase += `xit("line: ${index} - multi line regex not supported yet!", () => { });`; - return; - } + let flags = "m" + (parts[0].includes("i") ? "i" : ""); + flags += parts[0] !== "En$" && parts[0] !== "E$n" ? "s" : ""; if (regex.includes("\\b")) { testCase += `xit("line: ${index} - word boundary class not supported yet!", () => { });`; @@ -100,11 +108,6 @@ lines.forEach((line, index) => { return; } - // if (["}?"].some((f) => regex.includes(f))) { - // testCase += `xit("line: ${index} - lazy range repitition quantifiers are not supported", () => { });`; - // return; - // } - if (["(?"].some((f) => regex.includes(f))) { testCase += `xit("line: ${index} - non capturing groups not supported", () => {});`; return; @@ -130,10 +133,12 @@ lines.forEach((line, index) => { nextCase += ` const match = exec("${regex}", "${str}", "${flags}");`; // create an expect for each capture group - const captures = parts[3].match(/\((\d{1,2}|\?),(\d{1,2}|\?)\)+/g); + const captures = parts[3].match(/\((\d{1,3}|\?),(\d{1,3}|\?)\)+/g); captures.forEach((capture, index) => { - const digits = capture.match(/\((\d{1,2}|\?),(\d{1,2}|\?)\)/); - nextCase += `expect(match.matches[${index}]).toBe("${str}".substring(${digits[1]}, ${digits[2]}));`; + const digits = capture.match(/\((\d{1,3}|\?),(\d{1,3}|\?)\)/); + if (digits[1] !== "?") { + nextCase += `expect(match.matches[${index}]).toBe("${str}".substring(${digits[1]}, ${digits[2]}));`; + } }); } diff --git a/ts/index.ts b/ts/index.ts index 89080e1..c83b84b 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -5,6 +5,13 @@ globalAny.log = console.log; import { RegExp } from "../assembly/regexp"; -const regexObj = new RegExp("[a-c]", "i"); -const match = regexObj.exec("A"); +const regexObj = new RegExp("abc$", "m"); +let match = regexObj.exec("abc\n"); console.log(JSON.stringify(match, null, 2)); +// match = regexObj.exec("f1\nbar\nbaz\nf2"); +// console.log(JSON.stringify(match, null, 2)); + +// const regex = new RegExp("^f\\d{1}$", "gm"); + +// let match = regex.exec("f1\nbar\nbaz\nf2"); +// expect(match!.matches[0]).toBe("f1");