blob: de3ba279050303aab82883e8503c38ac24bfa771 [file] [log] [blame]
description("Test to ensure correct behaviour when using backreferences in a RegExp");
shouldBeTrue("/(...)\\1$/.test('abcabc')");
shouldBeFalse("/(...)\\1$/.test('abcdef')");
shouldBeFalse("/(...)\\2$/.test('abcabc')");
shouldBeFalse("/(...)\\2$/.test('abc')");
shouldBeTrue("/\\1(...)$/.test('abcabc')");
shouldBeTrue("/\\1(...)$/.test('abcdef')");
shouldBeFalse("/\\2(...)$/.test('abcabc')");
shouldBeFalse("/\\2(...)$/.test('abc')");
shouldBeTrue("/\\1?(...)$/.test('abc')");
shouldBeTrue("/\\1?(...)$/.test('abc')");
re = new RegExp("[^b]*((..)|(\\2))+Sz", "i");
shouldBeFalse("re.test('axabcd')");
shouldBeTrue("re.test('axabcsz')");