Script: Class Top Level RegExp

Class RegExp

The RegExp object is a static object that generates instances of a regular expression for pattern matching and monitors all regular expressions in the current window or frame. Consult ECMA standards for the format of the pattern strings supported by these regular expressions.

Properties

global : boolean

If the regular expression instance has the g modifier, then this property is set to true.

ignoreCase : boolean

If the regular expression instance has the i modifier, then this property is set to true.

lastIndex : Number

This is the zero-based index value of the character within the String where the next search for the pattern begins. In a new search, the value is zero.

multiline : boolean

If a search extends across multiple lines of test, the multiline property is set to true.

source : String

A String version of the characters used to create the regular expression. The value does not include the forward slash delimiters that surround the expression.

Constructor Summary

RegExp(pattern : String)

Constructs the regular expression using the specified pattern.

RegExp(pattern : String, attributes : String)

Constructs the regular expression using the specified pattern and attributes.

Method Summary

exec(string : String) : Array

Performs a search through the specified parameter for the current regular expression and returns an array of match information if successful.

test(string : String) : boolean

Returns true if there is a match of the regular expression anywhere in the specified parameter.

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constructor Detail

RegExp

publicRegExp(pattern : String)

Constructs the regular expression using the specified pattern.

Parameters:

pattern - the regular expression pattern to use.


RegExp

publicRegExp(pattern : String, attributes : String)

Constructs the regular expression using the specified pattern and attributes. See the class documentation for more information on the pattern and attributes.

Parameters:

pattern - the regular expression pattern to use.

attributes - one or more attributes that control how the regular expression is executed.


Method Detail

exec

exec(string : String) : Array

Performs a search through the specified parameter for the current regular expression and returns an array of match information if successful. Returns null if the search produces no results.

Parameters:

string - the String to apply the regular expression.

Returns:

an array of match information if successful, null otherwise.

test

test(string : String) : boolean

Returns true if there is a match of the regular expression anywhere in the specified parameter. No additional information is available about the results of the search.

Parameters:

string - the String to apply the regular expression.

Returns:

true if there is a match of the regular expression anywhere in the specified parameter, false otherwise.