Commit 78fc648d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Replace only the first match for non-regexp pattern in String.replace.

parent a37f74f5
......@@ -961,6 +961,9 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
if(FAILED(hres))
break;
}
if(!regexp)
break;
}
if(SUCCEEDED(hres))
......
......@@ -414,6 +414,15 @@ ok(r === "-ret-", "r = " + r + " expected '-ret-'");
r = "-[test]-".replace("[test]", replaceFunc3, "test");
ok(r === "-ret-", "r = " + r + " expected '-ret-'");
r = "x,x,x".replace("x", "y");
ok(r === "y,x,x", "r = " + r + " expected 'y,x,x'");
r = "x,x,x".replace("", "y");
ok(r === "yx,x,x", "r = " + r + " expected 'yx,x,x'");
r = "x,x,x".replace("", "");
ok(r === "x,x,x", "r = " + r + " expected 'x,x,x'");
r = "1,2,3".split(",");
ok(typeof(r) === "object", "typeof(r) = " + typeof(r));
ok(r.length === 3, "r.length = " + r.length);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment