assay
test suite

regex

55 tests · 9 with documented divergences

Test Subject Formula Category DVs
match-basic-substring REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello world\", \"world\")","excel":"=REGEXTEST(\"hello world\", \"world\")","lattice":"=REGEXMATCH(\"hello world\", \"world\")"} value
match-returns-false-when-no-match REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"xyz\")","excel":"=REGEXTEST(\"hello\", \"xyz\")","lattice":"=REGEXMATCH(\"hello\", \"xyz\")"} value
match-anchors-start-and-end REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"^hello$\")","excel":"=REGEXTEST(\"hello\", \"^hello$\")","lattice":"=REGEXMATCH(\"hello\", \"^hello$\")"} value
match-anchors-fail-on-partial-string REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello world\", \"^hello$\")","excel":"=REGEXTEST(\"hello world\", \"^hello$\")","lattice":"=REGEXMATCH(\"hello world\", \"^hello$\")"} value
match-start-anchor-only REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"^hel\")","excel":"=REGEXTEST(\"hello\", \"^hel\")","lattice":"=REGEXMATCH(\"hello\", \"^hel\")"} value
match-end-anchor-only REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"llo$\")","excel":"=REGEXTEST(\"hello\", \"llo$\")","lattice":"=REGEXMATCH(\"hello\", \"llo$\")"} value
match-digit-class REGEXMATCH {"gsheets":"=REGEXMATCH(\"abc 123\", \"\\d+\")","excel":"=REGEXTEST(\"abc 123\", \"\\d+\")","lattice":"=REGEXMATCH(\"abc 123\", \"\\d+\")"} value
match-digit-class-no-digits REGEXMATCH {"gsheets":"=REGEXMATCH(\"abc\", \"\\d+\")","excel":"=REGEXTEST(\"abc\", \"\\d+\")","lattice":"=REGEXMATCH(\"abc\", \"\\d+\")"} value
match-word-class REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello_world\", \"\\w+\")","excel":"=REGEXTEST(\"hello_world\", \"\\w+\")","lattice":"=REGEXMATCH(\"hello_world\", \"\\w+\")"} value
match-lowercase-range REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"[a-z]+\")","excel":"=REGEXTEST(\"hello\", \"[a-z]+\")","lattice":"=REGEXMATCH(\"hello\", \"[a-z]+\")"} value
match-lowercase-range-rejects-uppercase REGEXMATCH {"gsheets":"=REGEXMATCH(\"HELLO\", \"[a-z]+\")","excel":"=REGEXTEST(\"HELLO\", \"[a-z]+\")","lattice":"=REGEXMATCH(\"HELLO\", \"[a-z]+\")"} value
match-exact-count-quantifier REGEXMATCH {"gsheets":"=REGEXMATCH(\"abc123\", \"[a-z]{3}\\d{3}\")","excel":"=REGEXTEST(\"abc123\", \"[a-z]{3}\\d{3}\")","lattice":"=REGEXMATCH(\"abc123\", \"[a-z]{3}\\d{3}\")"} value
match-range-quantifier-within-bounds REGEXMATCH {"gsheets":"=REGEXMATCH(\"aab\", \"a{2,3}b\")","excel":"=REGEXTEST(\"aab\", \"a{2,3}b\")","lattice":"=REGEXMATCH(\"aab\", \"a{2,3}b\")"} value
match-range-quantifier-below-minimum REGEXMATCH {"gsheets":"=REGEXMATCH(\"ab\", \"a{2,3}b\")","excel":"=REGEXTEST(\"ab\", \"a{2,3}b\")","lattice":"=REGEXMATCH(\"ab\", \"a{2,3}b\")"} value
match-alternation-first-branch REGEXMATCH {"gsheets":"=REGEXMATCH(\"cat\", \"cat|dog\")","excel":"=REGEXTEST(\"cat\", \"cat|dog\")","lattice":"=REGEXMATCH(\"cat\", \"cat|dog\")"} value
match-alternation-second-branch REGEXMATCH {"gsheets":"=REGEXMATCH(\"dog\", \"cat|dog\")","excel":"=REGEXTEST(\"dog\", \"cat|dog\")","lattice":"=REGEXMATCH(\"dog\", \"cat|dog\")"} value
match-alternation-neither-branch REGEXMATCH {"gsheets":"=REGEXMATCH(\"fish\", \"cat|dog\")","excel":"=REGEXTEST(\"fish\", \"cat|dog\")","lattice":"=REGEXMATCH(\"fish\", \"cat|dog\")"} value
match-word-boundary-hit REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello world\", \"\\bworld\\b\")","excel":"=REGEXTEST(\"hello world\", \"\\bworld\\b\")","lattice":"=REGEXMATCH(\"hello world\", \"\\bworld\\b\")"} value
match-word-boundary-miss REGEXMATCH {"gsheets":"=REGEXMATCH(\"helloworld\", \"\\bworld\\b\")","excel":"=REGEXTEST(\"helloworld\", \"\\bworld\\b\")","lattice":"=REGEXMATCH(\"helloworld\", \"\\bworld\\b\")"} value
match-case-sensitive-by-default REGEXMATCH {"gsheets":"=REGEXMATCH(\"HELLO\", \"hello\")","excel":"=REGEXTEST(\"HELLO\", \"hello\")","lattice":"=REGEXMATCH(\"HELLO\", \"hello\")"} value
match-case-insensitive-via-inline-flag REGEXMATCH {"gsheets":"=REGEXMATCH(\"HELLO\", \"(?i)hello\")","excel":"=REGEXTEST(\"HELLO\", \"(?i)hello\")","lattice":"=REGEXMATCH(\"HELLO\", \"(?i)hello\")"} value
match-unicode-property-class-on-non-ascii-letters REGEXMATCH {"gsheets":"=REGEXMATCH(\"café\", \"\\p{L}+\")","excel":"=REGEXTEST(\"café\", \"\\p{L}+\")","lattice":"=REGEXMATCH(\"café\", \"\\p{L}+\")"} value 1
match-unicode-property-class-rejects-digits REGEXMATCH {"gsheets":"=REGEXMATCH(\"123\", \"\\p{L}\")","excel":"=REGEXTEST(\"123\", \"\\p{L}\")","lattice":"=REGEXMATCH(\"123\", \"\\p{L}\")"} value 1
match-unicode-property-class-on-cjk REGEXMATCH {"gsheets":"=REGEXMATCH(\"你好世界\", \"\\p{L}+\")","excel":"=REGEXTEST(\"你好世界\", \"\\p{L}+\")","lattice":"=REGEXMATCH(\"你好世界\", \"\\p{L}+\")"} value 1
match-non-ascii-literal REGEXMATCH {"gsheets":"=REGEXMATCH(\"Ångström\", \"Å\")","excel":"=REGEXTEST(\"Ångström\", \"Å\")","lattice":"=REGEXMATCH(\"Ångström\", \"Å\")"} value
extract-non-ascii-literal REGEXEXTRACT =REGEXEXTRACT("résumé template", "résumé") value
match-non-ascii-case-insensitive-via-inline-flag REGEXMATCH {"gsheets":"=REGEXMATCH(\"CAFÉ\", \"(?i)café\")","excel":"=REGEXTEST(\"CAFÉ\", \"(?i)café\")","lattice":"=REGEXMATCH(\"CAFÉ\", \"(?i)café\")"} value
extract-full-match-when-no-capture-groups REGEXEXTRACT =REGEXEXTRACT("abc 123 def", "\d+") value
extract-full-match-no-groups-with-dollar-sign REGEXEXTRACT =REGEXEXTRACT("Price: $100", "\$\d+") value
extract-first-of-multiple-full-matches REGEXEXTRACT =REGEXEXTRACT("one 1 two 2 three 3", "\d+") value
extract-single-capture-group REGEXEXTRACT =REGEXEXTRACT("Price: $100", "\$(\d+)") value
extract-capture-groups-when-multiple-groups-present REGEXEXTRACT =REGEXEXTRACT("2025-03-01", "(\d{4})-(\d{2})-(\d{2})") value
extract-two-word-groups REGEXEXTRACT =REGEXEXTRACT("foo bar baz", "(\w+)\s+(\w+)") value
extract-no-match-returns-na REGEXEXTRACT =REGEXEXTRACT("hello", "\d+") value
extract-no-match-on-empty-text REGEXEXTRACT =REGEXEXTRACT("", "\d+") value
extract-case-insensitive-via-inline-flag REGEXEXTRACT =REGEXEXTRACT("Hello World", "(?i)(\w+)") value
extract-return-mode-1-all-matches-row-vector REGEXEXTRACT =REGEXEXTRACT("a1 b2 c3", "\d+", 1) value 1
extract-return-mode-2-capture-groups-from-first-match REGEXEXTRACT =REGEXEXTRACT("2025-03-01", "(\d{4})-(\d{2})-(\d{2})", 2) value 1
replace-all-digits REGEXREPLACE =REGEXREPLACE("a1b2c3", "\d", "x") value
replace-greedy-pattern-all-occurrences REGEXREPLACE =REGEXREPLACE("aabbaa", "a+", "x") value
replace-whitespace-all REGEXREPLACE =REGEXREPLACE("hello world", "\s+", "-") value
replace-no-match-unchanged REGEXREPLACE =REGEXREPLACE("hello", "\d+", "x") value
replace-empty-text-unchanged REGEXREPLACE =REGEXREPLACE("", "\d+", "x") value
replace-with-single-backreference REGEXREPLACE =REGEXREPLACE("hello world", "(\w+)", "[$1]") value
replace-swap-first-and-last-name REGEXREPLACE =REGEXREPLACE("John Smith", "(\w+) (\w+)", "$2, $1") value
replace-date-reformat-three-groups REGEXREPLACE =REGEXREPLACE("2025-03-01", "(\d+)-(\d+)-(\d+)", "$3/$2/$1") value
replace-first-occurrence-only REGEXREPLACE {"excel":"=REGEXREPLACE(\"aabbaa\", \"a+\", \"x\", 1)","lattice":"=REGEXREPLACE(\"aabbaa\", \"a+\", \"x\", 1)"} value
replace-last-occurrence-only REGEXREPLACE {"excel":"=REGEXREPLACE(\"aabbaa\", \"a+\", \"x\", -1)","lattice":"=REGEXREPLACE(\"aabbaa\", \"a+\", \"x\", -1)"} value
replace-nth-occurrence REGEXREPLACE {"excel":"=REGEXREPLACE(\"a1 a2 a3\", \"a\\d\", \"x\", 2)","lattice":"=REGEXREPLACE(\"a1 a2 a3\", \"a\\d\", \"x\", 2)"} value
replace-case-insensitive-via-excel-param REGEXREPLACE {"excel":"=REGEXREPLACE(\"Hello WORLD hello\", \"hello\", \"hi\", 0, 1)","lattice":"=REGEXREPLACE(\"Hello WORLD hello\", \"hello\", \"hi\", 0, 1)"} value
extract-case-insensitive-via-4th-arg REGEXEXTRACT {"excel":"=REGEXEXTRACT(\"ITEM: ABC123\", \"item: ([A-Z]+\\d+)\", 0, 1)","lattice":"=REGEXEXTRACT(\"ITEM: ABC123\", \"item: ([A-Z]+\\d+)\", 0, 1)"} value 1
replace-case-insensitive-via-inline-flag REGEXREPLACE =REGEXREPLACE("Hello WORLD hello", "(?i)hello", "hi") value
lookbehind-in-pattern REGEXMATCH {"gsheets":"=REGEXMATCH(\"hello\", \"(?<=hel)lo\")","excel":"=REGEXTEST(\"hello\", \"(?<=hel)lo\")","lattice":"=REGEXMATCH(\"hello\", \"(?<=hel)lo\")"} value 1
lookahead-in-pattern REGEXMATCH {"gsheets":"=REGEXMATCH(\"foobar\", \"foo(?=bar)\")","excel":"=REGEXTEST(\"foobar\", \"foo(?=bar)\")","lattice":"=REGEXMATCH(\"foobar\", \"foo(?=bar)\")"} value 1
negative-lookahead-in-pattern REGEXMATCH {"gsheets":"=REGEXMATCH(\"foobar\", \"foo(?!baz)\")","excel":"=REGEXTEST(\"foobar\", \"foo(?!baz)\")","lattice":"=REGEXMATCH(\"foobar\", \"foo(?!baz)\")"} value 1