-
Notifications
You must be signed in to change notification settings - Fork 0
API Regex
Liu.Yandong.Hanks edited this page Aug 19, 2026
·
3 revisions
正则表达式值
Regular-expression value
Regex 创建可复用的正则表达式。它可以直接传给 String.match、String.matchAll 与 String.replace,或使用 test 只判断是否匹配。
Regexcreates reusable regular expressions. Pass one directly toString.match,String.matchAll, orString.replace, or usetestwhen only a Boolean result is required.
Parameters:
-
pattern
正则模式字符串或已有Regex。Regex pattern string or existing
Regex. -
flags
可选标志字符串。Optional flag string.
Returns
Regex 实例;仅传已有 Regex 且未提供 flags 时会返回该 Regex。
A
Regex; passing an existing regex without flags returns it unchanged.
var number = new Regex("^[0-9]+$");
return number.test("42"); // trueParameters:
-
value
要检查的文本。Text to inspect.
Returns
是否匹配。
Whether it matches.
var word = new Regex("aurora", "i");
return word.test("AuroraScript"); // trueAuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License