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);
Name Type Description
cx JSContext *

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

obj JS::HandleObject A pointer to a global object.
reobj JS::HandleObject A pointer to a RegExp object.
chars const char16_t * A pointer to the string contains a input string.
length size_t The length of bytes or chars, in characters.
indexp size_t * In/Out parameter. A pointer to the lastIndex for the execution, and received the updated lastIndex.
test bool Pass true to avoid creating match result array and store boolean value to rval.
rval JS::MutableHandleValue Out 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

Document Tags and Contributors

 Contributors to this page: arai, Sheppy, markg
 Last updated by: arai,