Lines Matching refs:RegExp
28 // Test the (deprecated as of JS 1.5) properties of the RegExp function.
34 assertEquals(s, RegExp.input);
35 assertEquals('123.456', RegExp.lastMatch);
36 assertEquals('456', RegExp.lastParen);
37 assertEquals('abc', RegExp.leftContext);
38 assertEquals('def', RegExp.rightContext);
40 assertEquals(s, RegExp['$_']);
41 assertEquals('123.456', RegExp['$&']);
42 assertEquals('456', RegExp['$+']);
43 assertEquals('abc', RegExp['$`']);
44 assertEquals('def', RegExp["$'"]);
46 assertEquals('123.456', RegExp['$1']);
47 assertEquals('123', RegExp['$2']);
48 assertEquals('456', RegExp['$3']);
50 assertEquals('', RegExp['$' + i]);
54 RegExp['$1'] = 'fisk';
55 assertEquals('123.456', RegExp['$1']);
58 // regexp) and also RegExp.prototype.test should all behave as if
59 // RegExp.prototype.exec were called.
62 assertEquals(s, RegExp.input);
63 assertEquals('789.012', RegExp.lastMatch);
64 assertEquals('012', RegExp.lastParen);
65 assertEquals('ghi', RegExp.leftContext);
66 assertEquals('jkl', RegExp.rightContext);
67 assertEquals(s, RegExp['$_']);
68 assertEquals('789.012', RegExp['$&']);
69 assertEquals('012', RegExp['$+']);
70 assertEquals('ghi', RegExp['$`']);
71 assertEquals('jkl', RegExp["$'"]);
72 assertEquals('789.012', RegExp['$1']);
73 assertEquals('789', RegExp['$2']);
74 assertEquals('012', RegExp['$3']);
76 assertEquals('', RegExp['$' + i]);
81 assertEquals(s, RegExp.input);
82 assertEquals('123.456', RegExp.lastMatch);
83 assertEquals('456', RegExp.lastParen);
84 assertEquals('abc', RegExp.leftContext);
85 assertEquals('def', RegExp.rightContext);
86 assertEquals(s, RegExp['$_']);
87 assertEquals('123.456', RegExp['$&']);
88 assertEquals('456', RegExp['$+']);
89 assertEquals('abc', RegExp['$`']);
90 assertEquals('def', RegExp["$'"]);
91 assertEquals('123.456', RegExp['$1']);
92 assertEquals('123', RegExp['$2']);
93 assertEquals('456', RegExp['$3']);
95 assertEquals('', RegExp['$' + i]);
100 assertEquals(s, RegExp.input);
101 assertEquals('789.012', RegExp.lastMatch);
102 assertEquals('012', RegExp.lastParen);
103 assertEquals('ghi', RegExp.leftContext);
104 assertEquals('jkl', RegExp.rightContext);
105 assertEquals(s, RegExp['$_']);
106 assertEquals('789.012', RegExp['$&']);
107 assertEquals('012', RegExp['$+']);
108 assertEquals('ghi', RegExp['$`']);
109 assertEquals('jkl', RegExp["$'"]);
110 assertEquals('789.012', RegExp['$1']);
111 assertEquals('789', RegExp['$2']);
112 assertEquals('012', RegExp['$3']);
114 assertEquals('', RegExp['$' + i]);
118 // global regexp is matched and replaced with the result of a function, in
119 // case the function uses the static properties of the regexp constructor.
121 function f() { return RegExp.$1; };
127 assertEquals("", RegExp.lastParen, "lastParen");
139 var re = new RegExp(re_text);
142 assertEquals("x", RegExp['$' + j], "$" + j + " in $" + i + " setup");
144 assertEquals("", RegExp['$' + (i)], "$" + i);
147 RegExp.multiline = "foo";
148 assertTrue(typeof RegExp.multiline == typeof Boolean(), "RegExp.multiline coerces values to booleans");
149 RegExp.input = Number();
150 assertTrue(typeof RegExp.input == typeof String(), "RegExp.input coerces values to booleans");
154 var foo = "lsdfj sldkfj sdklfj læsdfjl sdkfjlsdk fjsdl fjsdljskdj flsj flsdkj flskd regexp: /foobar/\nldkfj sdlkfj sdkl";
155 assertTrue(/^([a-z]+): (.*)/.test(foo.substring(foo.indexOf("regexp:"))), "regexp: setup");
156 assertEquals("regexp", RegExp.$1, "RegExp.$1");