Regex regular expression

Regex regular expression

Regex regular expression

Function

Regex objects are created by regex(pattern, flags) and support test, match, replace and to_string. String prototype search, match, replace can also receive Regex parameters.

API List

APIDescription
Regex.testDetermine whether the text matches the current regular expression.
Regex.matchReturns all matching fragments in the text.
Regex.replaceReplace text using the current regular expression.
Regex.to_stringReturns the script text form of the regular expression.

Examples

Notes

  • Supported flags include i, m, s; the global replacement of replace additionally reads the g flag.