Lines Matching full:replace
29 * @fileoverview Test String.prototype.replace
34 "\"" + subject + "\".replace(" + pattern + ", " + replacement + ")";
35 assertEquals(result, subject.replace(pattern, replacement), name);
120 // Replace with functions.
125 assertEquals(3, arguments.length, "replace('x',func) func-args");
126 assertEquals("x", m, "replace('x',func(m,..))");
127 assertEquals(0, i, "replace('x',func(..,i,..))");
128 assertEquals(short, s, "replace('x',func(..,s))");
131 assertEquals(1, ctr, "replace('x',func) num-match");
135 assertEquals(3, arguments.length, "replace(/x/,func) func-args");
136 assertEquals("x", m, "replace(/x/,func(m,..))");
137 assertEquals(0, i, "replace(/x/,func(..,i,..))");
138 assertEquals(short, s, "replace(/x/,func(..,s))");
141 assertEquals(1, ctr, "replace(/x/,func) num-match");
145 assertEquals(3, arguments.length, "replace(/x/g,func) func-args");
146 assertEquals("x", m, "replace(/x/g,func(m,..))");
147 assertEquals(ctr * 2, i, "replace(/x/g,func(..,i,.))");
148 assertEquals(short, s, "replace(/x/g,func(..,s))");
151 assertEquals(4, ctr, "replace(/x/g,func) num-match");
155 assertEquals(5, arguments.length, "replace(/(x)(?=(.))/g,func) func-args");
156 assertEquals("x", m, "replace(/(x)(?=(.))/g,func(m,..))");
157 assertEquals("x", c1, "replace(/(x)(?=(.))/g,func(..,c1,..))");
158 assertEquals(["a","b","c"][ctr], c2, "replace(/(x)(?=(.))/g,func(..,c2,..))");
159 assertEquals(ctr * 2, i, "replace(/(x)(?=(.))/g,func(..,i,..))");
160 assertEquals(short, s, "replace(/(x)(?=(.))/g,func(..,s))");
163 assertEquals(3, ctr, "replace(/x/g,func) num-match");
195 // Test nested calls to replace, including that it sets RegExp.$& correctly.
200 + m.replace(/./g,"$&$&") + "-"
201 + m.replace(/./g,function() { return RegExp['$&']; })
214 str.replace(re,"$$" + 'sch'))
218 assertEquals("axc", "abc".replace(/b/, replace_obj));
219 assertEquals("axc", "abc".replace(/b/g, replace_obj));
222 assertEquals("axc", "abc".replace(search_obj, function() { return "x"; }));
228 assertEquals("abc", "abc".replace(/z/g, replace_obj_side_effects));
242 subject.replace(re, "$" + i));
248 subject.replace(re, "$0" + i));
251 assertEquals("$0", subject.replace(re, "$0"));
252 assertEquals("$00", subject.replace(re, "$00"));
254 subject.replace(re, "$100"));
270 subject.replace(re, "$" + i));