JS_NewRegExpObject 编辑
Create a new RegExp
object.
Syntax
JSObject *
JS_NewRegExpObject(JSContext *cx, JS::HandleObject obj,
const char *bytes, size_t length,
unsigned flags);
JSObject *
JS_NewUCRegExpObject(JSContext *cx, JS::HandleObject obj,
const char16_t *chars, size_t length,
unsigned flags);
JSObject *
JS_NewRegExpObjectNoStatics(JSContext *cx, char *bytes, size_t length,
unsigned flags);
JSObject *
JS_NewUCRegExpObjectNoStatics(JSContext *cx, char16_t *chars, size_t length,
unsigned flags);
Name | Type | Description |
---|---|---|
cx | JSContext * | The context in which to create the new object. Requires request. In a |
obj | JS::HandleObject | A pointer to a global object. |
bytes or chars | const char * or const char16_t * | A pointer to the string that contains a regular expression. |
length | size_t | The length of bytes or chars , in characters. |
flags | unsigned | Regular expression flags. See below. |
Flags
Name | Description | RegExp constructor flag |
---|---|---|
JSREG_FOLD | Fold uppercase to lowercase. | i |
JSREG_GLOB | Global execution, creates array of matches. | g |
JSREG_MULTILINE | Treat ^ and $ as begin and end of line. | m |
JSREG_STICKY | Only match starting at lastIndex . | y |
Description
JS_NewRegExpObject
and JS_NewUCRegExpObject
create a new RegExp
instance. The flags from the built-in RegExp
constructor properties ignoreCase
, global
, multiline
, and sticky
are OR
'd in with the provided flags
parameter.
JS_NewRegExpObjectNoStatics
and JS_NewUCRegExpObjectNoStatics
create a new RegExp
instance. They do not OR
in any RegExp
constructor properties.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论