blob: a2e1d9ed79cedcad59c303f6832a0c8705f8e2c1 [file] [log] [blame]
Test for unicode regular expression processing
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS "a".match(/a/u)[0].length is 1
PASS "a".match(/A/ui)[0].length is 1
PASS "a".match(/a/u)[0].length is 1
PASS "a".match(/A/iu)[0].length is 1
PASS "Ȓ".match(/Ȓ/u)[0].length is 1
PASS "Ȓ".match(/Ȓ/u)[0].length is 1
PASS "ሴ".match(/ሴ/u)[0].length is 1
PASS "ሴ".match(/ሴ/u)[0].length is 1
PASS "⪼".match(/⪼/u)[0].length is 1
PASS "㿭".match(/㿭/u)[0].length is 1
PASS "𒍅".match(/𒍅/u)[0].length is 2
PASS "𒍅".match(/𒍅/u)[0].length is 2
PASS "𝌆".match(/𝌆/u)[0].length is 2
PASS /𐑏/u.test("𐑏") is true
PASS /𐑏/u.test("𐑏") is true
PASS "𝌆".match(/𝌆/u)[0].length is 2
PASS /(𐀀|𐐀|𐐩)/u.test("𐐀") is true
PASS "𐄣".match(/a|𐄣|b/u)[0].length is 2
PASS "b".match(/a|𐄣|b/u)[0].length is 1
PASS /(?:a|𐄣|b)x/u.test("𐄣") is false
PASS /(?:a|𐄣|b)x/u.test("𐄣x") is true
PASS /(?:a|𐄣|b)x/u.test("b") is false
PASS /(?:a|𐄣|b)x/u.test("bx") is true
PASS "a𐄣x".match(/a𐄣b|a𐄣x/u)[0].length is 4
PASS /(𐀀|𐐀|𐐩)x/ui.test("𐐀x") is true
PASS /(𐀀|𐐀|𐐩)x/ui.test("𐐩x") is true
PASS /(𐀀|𐐀|𐐩)x/ui.test("𐐁x") is true
PASS /(𐀀|𐐀|𐐩)x/ui.test("𐐨x") is true
PASS "𐐩".match(/a|𐐁|b/iu)[0].length is 2
PASS "B".match(/a|𐄣|b/iu)[0].length is 1
PASS /(?:A|𐄣|b)x/iu.test("𐄣") is false
PASS /(?:A|𐄣|b)x/iu.test("𐄣x") is true
PASS /(?:A|𐄣|b)x/iu.test("b") is false
PASS /(?:A|𐄣|b)x/iu.test("bx") is true
PASS "a𐄣X".match(/a𐄣b|a𐄣x/iu)[0].length is 4
PASS "Ťx".match(/ťx/iu)[0].length is 2
PASS /\w/iu.test("ſ") is true
PASS /\w/iu.test("K") is true
PASS /\W/iu.test("ſ") is false
PASS /\W/iu.test("K") is false
PASS /[\w\d]/iu.test("ſ") is true
PASS /[\w\d]/iu.test("K") is true
PASS /[^\w\d]/iu.test("ſ") is false
PASS /[^\w\d]/iu.test("K") is false
PASS /[\W\d]/iu.test("ſ") is false
PASS /[\W\d]/iu.test("K") is false
PASS /[^\W\d]/iu.test("ſ") is true
PASS /[^\W\d]/iu.test("K") is true
PASS /\w/iu.test("S") is true
PASS /\w/iu.test("K") is true
PASS /\W/iu.test("S") is false
PASS /\W/iu.test("K") is false
PASS /[\w\d]/iu.test("S") is true
PASS /[\w\d]/iu.test("K") is true
PASS /[^\w\d]/iu.test("S") is false
PASS /[^\w\d]/iu.test("K") is false
PASS /[\W\d]/iu.test("S") is false
PASS /[\W\d]/iu.test("K") is false
PASS /[^\W\d]/iu.test("S") is true
PASS /[^\W\d]/iu.test("K") is true
PASS "Grasſoden is old German for grass".match(/.*?\Bs\u017foden/iu)[0] is "Grasſoden"
PASS "Grasſoden is old German for grass".match(/.*?\B\u017foden/iu)[0] is "Grasſoden"
PASS "Grasſoden is old German for grass".match(/.*?\Boden/iu)[0] is "Grasſoden"
PASS "Grasſoden is old German for grass".match(/.*?\Bden/iu)[0] is "Grasſoden"
PASS "Water freezes at 273K which is 0C.".split(/\b\s/iu) is ["Water","freezes","at","273K","which","is","0C."]
PASS "𝌆".match(/^.$/u)[0].length is 2
PASS "It is 78°".match(/.*/u)[0].length is 9
PASS stringWithDanglingFirstSurrogate.match(/.*/u)[0].length is 3
PASS stringWithDanglingSecondSurrogate.match(/.*/u)[0].length is 3
PASS "𝌆".match(/[𝌆a]/)[0].length is 1
PASS "𝌆".match(/[a𝌆]/u)[0].length is 2
PASS "𝌆".match(/[𝌆a]/u)[0].length is 2
PASS "𝌆".match(/[a-𝌆]/)[0].length is 1
PASS "𝌆".match(/[a-𝌆]/u)[0].length is 2
PASS "X".match(/[ -𐑏]/u)[0].length is 1
PASS "က".match(/[ -𐑏]/u)[0].length is 1
PASS "𐐧".match(/[ -𐑏]/u)[0].length is 2
PASS re1.test("Z") is false
PASS re1.test("က") is false
PASS re1.test("𐐀") is false
PASS re2.test("A") is true
PASS re2.test("￿") is false
PASS re2.test("𒍅") is true
PASS /[𐰁�#�]/u.exec("𐰁").toString() is "𐰁"
PASS /[�𐰁�]/u.exec("𐰁").toString() is "𐰁"
PASS /[�#�𐰁]/u.exec("𐰁").toString() is "𐰁"
PASS /[�𐰁�]/u.exec("𐰁").toString() is "𐰁"
PASS /[𐰁�#�]{2}/u.exec("𐰁") is null
PASS /[�𐰁�]{2}/u.exec("𐰁") is null
PASS /[�#�𐰁]{2}/u.exec("𐰁") is null
PASS /[�𐰁�]{2}/u.exec("𐰁") is null
PASS /�|�|𐰁/u.exec("𐰁").toString() is "𐰁"
PASS /�|𐰁|�/u.exec("𐰁").toString() is "𐰁"
PASS /�|�|𐰁/u.exec("�").toString() is "�"
PASS /�|𐰁|�/u.exec("�").toString() is "�"
PASS /�𐰁/u.exec("𐰁") is null
PASS /�𐰁/u.exec("�") is null
PASS "�𐰁".match(/�𐰁/u)[0].length is 3
PASS /𝌆{2}/u.test("𝌆𝌆") is true
PASS /𝌆{2}/u.test("𝌆𝌆") is true
PASS "𐐅𐐅𐐅𐐅".match(/𐐅{3}/u)[0] is "𐐅𐐅𐐅"
PASS "𐐂𐐅𐐅𐐅".match(/𐐅{3}/u)[0] is "𐐅𐐅𐐅"
PASS "𐐁𐐁𐐀".match(/𐐁{1,3}/u)[0] is "𐐁𐐁"
PASS "𐐁𐐩".match(/𐐁{1,3}/iu)[0] is "𐐁𐐩"
PASS "𐐁𐐩𐐪𐐩".match(/𐐁{1,}/iu)[0] is "𐐁𐐩"
PASS "𐌑𐌑𐌑".match(/𐌑*a|𐌑*./u)[0] is "𐌑𐌑𐌑"
PASS "a𐌑𐌑".match(/a𐌑*?$/u)[0] is "a𐌑𐌑"
PASS "a𐌑𐌑𐌑c".match(/a𐌑*cd|a𐌑*c/u)[0] is "a𐌑𐌑𐌑c"
PASS "a𐌑𐌑𐌑c".match(/a𐌑+cd|a𐌑+c/u)[0] is "a𐌑𐌑𐌑c"
PASS "𐌑𐌑𐌑".match(/𐌑+?a|𐌑+?./u)[0] is "𐌑𐌑"
PASS "𐌑𐌑𐌑".match(/𐌑+?a|𐌑+?$/u)[0] is "𐌑𐌑𐌑"
PASS "a𐌑𐌑𐌑c".match(/a𐌑*?cd|a𐌑*?c/u)[0] is "a𐌑𐌑𐌑c"
PASS "a𐌑𐌑𐌑c".match(/a𐌑+?cd|a𐌑+?c/u)[0] is "a𐌑𐌑𐌑c"
PASS "𐌑𐌑𐌑".match(/𐌑+?a|𐌑+?./iu)[0] is "𐌑𐌑"
PASS "𐐪𐐪𐌑".match(/𐐂*𐈀|𐐂*𐌑/iu)[0] is "𐐪𐐪𐌑"
PASS "𐐪𐐪𐌑".match(/𐐂+𐈀|𐐂+𐌑/iu)[0] is "𐐪𐐪𐌑"
PASS "𐐪𐐪𐌑".match(/𐐂*?𐈀|𐐂*?𐌑/iu)[0] is "𐐪𐐪𐌑"
PASS "𐐪𐐪𐌑".match(/𐐂+?𐈀|𐐂+?𐌑/iu)[0] is "𐐪𐐪𐌑"
PASS "ab𐌑c𐨁".match(/abc|ab𐌑cd|ab𐌑c𐨁d|ab𐌑c𐨁/u)[0] is "ab𐌑c𐨁"
PASS "ab𐐨c𐨁".match(/abc|ab𐐀cd|ab𐐀c𐨁d|ab𐐀c𐨁/iu)[0] is "ab𐐨c𐨁"
PASS /abc|ab𐐀cd|ab𐐀c𐨁d|ab𐐀c𐨁/iu.test("qwerty123") is false
PASS "a𐐨𐐨𐐨c".match(/ac|a𐐀*cd|a𐐀+cd|a𐐀+c/iu)[0] is "a𐐨𐐨𐐨c"
PASS "ab𐐨𐐨𐐨c𐨁".match(/abc|ab𐐀*cd|ab𐐀+c𐨁d|ab𐐀+c𐨁/iu)[0] is "ab𐐨𐐨𐐨c𐨁"
PASS "ab𐐨𐐨𐐨".match(/abc|ab𐐨*./u)[0] is "ab𐐨𐐨𐐨"
PASS "ab𐐨𐐨𐐨".match(/abc|ab𐐀*./iu)[0] is "ab𐐨𐐨𐐨"
PASS "𐐀".match(/a*/u)[0].length is 0
PASS "𐐀".match(/a*/ui)[0].length is 0
PASS "𐐀".match(/\d*/u)[0].length is 0
PASS "123𐐀".match(/\d*/u)[0] is "123"
PASS "12X3𐐀4".match(/\d{0,1}/ug) is ["1", "2", "", "3", "", "4", ""]
PASS "𐐂𐐅𐐅𐐂𐐅𐐅𐐅".match(/𐐅{3}/u)[0] is "𐐅𐐅𐐅"
PASS "a𐐐𐐐b".match(/a(𐐐*?)bc|a(𐐐*?)b/ui)[0] is "a𐐐𐐐b"
PASS match3[0] is "a𐐐𐐐b"
PASS match3[1] is undefined.
PASS match3[2] is "a𐐐𐐐b"
PASS match4[0] is "a𐐸𐐸b"
PASS match4[1] is undefined.
PASS match4[2] is "𐐸𐐸"
PASS match5[0] is "a𐐒𐐒b𐐒𐐒"
PASS match5[1] is undefined.
PASS match5[2] is "𐐒𐐒"
PASS match6[0] is "a𐐒𐐒b𐐺𐐒"
PASS match6[1] is undefined.
PASS match6[2] is "𐐒𐐒"
PASS /ſtop/ui.test("stop") is true
PASS /stop/ui.test("ſtop") is true
PASS /Kelvin/ui.test("kelvin") is true
PASS /KELVIN/ui.test("Kelvin") is true
PASS /\u{1}/.test("u") is true
PASS /\u{4}/.test("u") is false
PASS /\u{4}/.test("uuuu") is true
PASS "800-555-1212".match(/[0-9\-]*/u)[0].length is 12
PASS "🂡🃑🂸🃉🃚".match(re7)[0] is "🂡🃑"
PASS "🂡🃑🂱🃉🃚".match(re7)[0] is "🂡🃑🂱"
PASS "🂡🃑🂱🃁🃚".match(re7)[0] is "🂡🃑🂱🃁"
PASS "🂣🃑🂱🃁🃚".match(re7)[0] is "🃑🂱🃁"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]*a|[𐌐𐌑]*./iu)[0] is "𐌑𐌐𐌑"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]*?a|[𐌐𐌑]*?./iu)[0] is "𐌑"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+a|[𐌐𐌑]+./iu)[0] is "𐌑𐌐𐌑"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+?a|[𐌐𐌑]+?./iu)[0] is "𐌑𐌐"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑]+?a$|[𐌐𐌑]+?.$/iu)[0] is "𐌑𐌐𐌑"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑x]+a|[𐌐𐌑x]+./iu)[0] is "𐌑𐌐𐌑"
PASS "𐌑𐌐𐌑".match(/[𐌁𐌑x]+?a|[𐌐𐌑x]+?./iu)[0] is "𐌑𐌐"
PASS "C83|НАЧАТЬ".match(re8)[0] is "C83|НАЧАТЬ"
PASS "This.Is.16.Chars|НАЧАТЬ".match(re8)[0] is "This.Is.16.Chars|НАЧАТЬ"
PASS "Testing\nሴ 1 2 3".match(/^[က-𐃿] 1 2 3/um)[0] is "ሴ 1 2 3"
PASS "Testing\n𐃰 1 2 3".match(/^[က-𐃿] 1 2 3/um)[0] is "𐃰 1 2 3"
PASS "g\nሴ 1 2 3".match(/g\n^[က-𐃿] 1 2 3/um)[0] is "g\nሴ 1 2 3"
PASS "g\n𐃰 1 2 3".match(/g\n^[က-𐃿] 1 2 3/um)[0] is "g\n𐃰 1 2 3"
PASS "Testing ሴ\n1 2 3".match(/Testing [က-𐃿]$/um)[0] is "Testing ሴ"
PASS "Testing 𐃰\n1 2 3".match(/Testing [က-𐃿]$/um)[0] is "Testing 𐃰"
PASS "Testing ሴ\n1 2 3".match(/g [က-𐃿]$\n1/um)[0] is "g ሴ\n1"
PASS "Testing 𐃰\n1 2 3".match(/g [က-𐃿]$\n1/um)[0] is "g 𐃰\n1"
PASS "this is ba test".match(/is b\cha test/u)[0].length is 11
PASS new RegExp("\\/", "u").source is "\\/"
PASS r = new RegExp("\\u{110000}", "u") threw exception SyntaxError: Invalid regular expression: invalid Unicode code point \u{} escape.
PASS r = new RegExp("𐐅{2147483648}", "u") threw exception SyntaxError: Invalid regular expression: pattern exceeds string length limits.
PASS /{/u threw exception SyntaxError: Invalid regular expression: incomplete {} quantifier for Unicode pattern.
PASS /[a-\d]/u threw exception SyntaxError: Invalid regular expression: invalid range in character class for Unicode pattern.
PASS /]/u threw exception SyntaxError: Invalid regular expression: unmatched ] or } bracket for Unicode pattern.
PASS /\c9/u threw exception SyntaxError: Invalid regular expression: invalid \c escape for Unicode pattern.
PASS r = new RegExp("\\-", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("\\a", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("[\\a]", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("[\\B]", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("\\x", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("[\\x]", "u") threw exception SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern.
PASS r = new RegExp("\\u", "u") threw exception SyntaxError: Invalid regular expression: invalid Unicode \u escape.
PASS r = new RegExp("[\\u]", "u") threw exception SyntaxError: Invalid regular expression: invalid Unicode \u escape.
PASS r = new RegExp("\\u{", "u") threw exception SyntaxError: Invalid regular expression: invalid Unicode code point \u{} escape.
PASS r = new RegExp("\\u{\udead", "u") threw exception SyntaxError: Invalid regular expression: invalid Unicode code point \u{} escape.
PASS /\1/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\2/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\3/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\4/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\5/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\6/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\7/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\8/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\9/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /(.)\1/u did not throw exception.
PASS /(.)(.)\2/u did not throw exception.
PASS /(.)(.)\3/u threw exception SyntaxError: Invalid regular expression: invalid backreference for Unicode pattern.
PASS /\1/ did not throw exception.
PASS /\2/ did not throw exception.
PASS /\3/ did not throw exception.
PASS /\4/ did not throw exception.
PASS /\5/ did not throw exception.
PASS /\6/ did not throw exception.
PASS /\7/ did not throw exception.
PASS /\8/ did not throw exception.
PASS /\9/ did not throw exception.
PASS successfullyParsed is true
TEST COMPLETE