Class

RegExp

 Wraps regular expressions.

QuickLinks

RegExp, compile, exec, test, toString

Properties

PropertyTypeAccessDescription
$1stringreadonlyThe matched subexpression #1.
$2stringreadonlyThe matched subexpression #2.
$3stringreadonlyThe matched subexpression #3.
$4stringreadonlyThe matched subexpression #4.
$5stringreadonlyThe matched subexpression #5.
$6stringreadonlyThe matched subexpression #6.
$7stringreadonlyThe matched subexpression #7.
$8stringreadonlyThe matched subexpression #8.
$9stringreadonlyThe matched subexpression #9.
globalboolr/wIndicates whether the match is a global match.
ignoreCaseboolr/wIndicates whether the match is not case sensitive.
inputstringr/wThe original input string.
lastMatchstringreadonlyThe last match.
lastParenstringreadonlyThe value of the last matched subexpression.
leftContextstringreadonlyThe string before the match.
multilineboolr/wIndicates whether the match matches multiple lines.
rightContextstringreadonlyThe string after the match.

Methods

RegExp RegExp (pattern:string)
Creates and returns a new RegExp object set to the value of the argument converted to a regular expression.

ParameterTypeDescription
patternstringThe pattern to convert.

bool compile (pattern:string)
Compiles a string to a regular expression. Returns true if the compilation was successful.

ParameterTypeDescription
patternstringThe pattern to compile.

Array exec (text:string)
Execute a regular expression.

ParameterTypeDescription
textstringThe string to match.

bool test (text:string)
Execute a regular expression, and return true if there is a match.

ParameterTypeDescription
textstringThe string to match.

string toString ()
Converts this RegExp object to a string.

Used in

String.match (regexp:RegExp)

String.search (search:RegExp)

Return

RegExp RegExp.RegExp (pattern:string)

Contents :: Index