diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 0385a226330..6aa630214a8 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -596,9 +596,12 @@ static HRESULT String_match(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM TRACE("\n"); - if(arg_cnt(dp) != 1) { - FIXME("unsupported args\n"); - return E_NOTIMPL; + if(!arg_cnt(dp)) { + if(retv) { + V_VT(retv) = VT_NULL; + } + + return S_OK; } arg_var = get_arg(dp, 0); diff --git a/dlls/jscript/tests/regexp.js b/dlls/jscript/tests/regexp.js index 68091019f2b..3e4db68c4af 100644 --- a/dlls/jscript/tests/regexp.js +++ b/dlls/jscript/tests/regexp.js @@ -31,7 +31,7 @@ ok(m["0"] === "ab", "m[0] is not \"ab\""); m = "abcabc".match(/ab/g); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\""); @@ -41,7 +41,7 @@ ok(m === null, "m is not null"); m = "abcabc".match(/Ab/gi); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\""); @@ -64,22 +64,30 @@ ok(m["0"] === "ab", "m[0] is not \"ab\""); m = "abcabc".match(new RegExp("ab","g")); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\""); m = "abcabc".match(new RegExp(/ab/g)); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\""); m = "abcabc".match(new RegExp("ab","g", "test")); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\""); +m = "abcabcg".match("ab", "g"); +ok(typeof(m) === "object", "typeof m is not object"); +ok(m.length === 1, "m.length is not 1"); +ok(m["0"] === "ab", "m[0] is not \"ab\""); + +m = "abcabc".match(); +ok(m === null, "m is not null"); + r = "- [test] -".replace(/\[([^\[]+)\]/g, "success"); ok(r === "- success -", "r = " + r + " expected '- success -'");