RegExp

Wraps a regular expression.

Methods:

RegExp, compile, exec, test, toString

Property Listing

Name

Type

Access

Description

$1

String

readonly

The matched subexpression #1.

$2

String

readonly

The matched subexpression #2.

$3

String

readonly

The matched subexpression #3.

$4

String

readonly

The matched subexpression #4.

$5

String

readonly

The matched subexpression #5.

$6

String

readonly

The matched subexpression #6.

$7

String

readonly

The matched subexpression #7.

$8

String

readonly

The matched subexpression #8.

$9

String

readonly

The matched subexpression #9.

global

Boolean

readonly

Indicates whether the match is a global match.

ignoreCase

Boolean

readonly

Indicates whether the match is not case sensitive.

input

String

readonly

The original input string.

lastMatch

String

readonly

The last match.

lastParen

String

readonly

The value of the last matched subexpression.

leftContext

String

readonly

The string before the match.

multiline

Boolean

readonly

Indicates whether the match matches multiple lines.

rightContext

String

readonly

The string after the match.

Method Listing

Constructor

RegExp RegExp (pattern:String, [flags:String])

Creates and returns a new RegExp object set to the value of the argument converted to a regular expression.

Parameter

Type

Description

pattern

String

The pattern to convert.

flags

String

Flags that control how the conversion is performed.

A string containing any combination of the letters i, m, g: "i" -- ignore case in pattern matching "m" -- treat the string as multiple lines "g" -- do global pattern matching

Boolean compile (pattern:String)

Compiles a string to a regular expression. Returns true if the compilation was successful.

Parameter

Type

Description

pattern

String

The pattern to compile.

Array exec (text:String)

Execute a regular expression.

The return value is an array of matches, with the first element containing the match, and successive elements containing the results of any matching subexpression in their order of appearance. If there is no match, the result is null.

Parameter

Type

Description

text

String

The string to match.

Boolean test (text:String)

Execute a regular expression, and return true if there is a match.

Parameter

Type

Description

text

String

The string to match.

String toString ()

Converts this RegExp object to a string.

Return

RegExp.RegExp()