JS_ExecuteRegExp 编辑

Execute a new RegExp object to given input string.

Syntax

bool
JS_ExecuteRegExp(JSContext *cx, JS::HandleObject obj, JS::HandleObject reobj,
                 char16_t *chars, size_t length, size_t *indexp, bool test,
                 JS::MutableHandleValue rval);

bool
JS_ExecuteRegExpNoStatics(JSContext *cx, JS::HandleObject reobj,
                          char16_t *chars, size_t length,
                          size_t *indexp, bool test,
                          JS::MutableHandleValue rval);
NameTypeDescription
cxJSContext *

The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.

objJS::HandleObjectA pointer to a global object.
reobjJS::HandleObjectA pointer to a RegExp object.
charsconst char16_t *A pointer to the string contains a input string.
lengthsize_tThe length of bytes or chars, in characters.
indexpsize_t *In/Out parameter. A pointer to the lastIndex for the execution, and received the updated lastIndex.
testboolPass true to avoid creating match result array and store boolean value to rval.
rvalJS::MutableHandleValueOut parameter. Receives the result match result array or boolean value.

Description

JS_ExecuteRegExp and JS_NewRegExpObjectNoStatics execute the RegExp object, reobj, to the specified input string, chars, from *indexp index.

If test is false, JS_ExecuteRegExp and JS_NewRegExpObjectNoStatics store the match result array to *rval if matches, otherwise stores null to *rval. If test is true, JS_ExecuteRegExp and JS_NewRegExpObjectNoStatics store the boolean value true to *rval if matches, otherwise stores null to *rval.

JS_ExecuteRegExp updates the built-in RegExp object's properties.

If successful, JS_ExecuteRegExp and JS_NewRegExpObjectNoStatics returns true and stores the result to *rval, otherwise returns false and the value of *rval is undefined

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:90 次

字数:4969

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文