Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:RegExp:prototype

From MDC


Contents

[edit] Summary

Represents the prototype object for the RegExp constructor.

Property of RegExp
Implemented in: JavaScript 1.1, NES2.0
ECMA Version: ECMA-262

[edit] Description

RegExp instances inherit from RegExp.prototype. Modifications to the prototype object are propagated to all RegExp instances.

[edit] Properties

Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.

constructor
Specifies the function that creates an object's prototype.
global
Whether to test the regular expression against all possible matches in a string, or only against the first.
ignoreCase
Whether to ignore case while attempting a match in a string.
lastIndex
The index at which to start the next match.
multiline
Whether or not to search in strings across multiple lines.
source
The text of the pattern.

[edit] Methods

exec
Executes a search for a match in its string parameter.
test
Tests for a match in its string parameter.
toSource
Non-standard
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource method.
toString
Returns a string representing the specified object. Overrides the Object.prototype.toString method.

Methods inherited from Object.prototype
__defineGetter__, __defineSetter__, hasOwnProperty, isPrototypeOf, __lookupGetter__, __lookupSetter__, __noSuchMethod__, propertyIsEnumerable, unwatch, valueOf, watch

[edit] See also