JavaScript Reference :: RegExp

A Regular Expression object can be created by passing the pattern to the constructor.

var oRegEx = new RegExp("[b{2}]|[^b{2]");

methods

compile
Compiles a Regular Expression object.
exec
Evaluates the Regular Expression object and returns a match array.
boolean test(string)
Returns true when the pattern is found in the string.
object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

$
The input.
$&
The lastMatch.
$'
The rightContext.
$*
The multiline.
$+
The lastParen.
$`
The leftContext.
$1
The first remembered pattern match.
$2
The second remembered pattern match.
$3
The third remembered pattern match.
$4
The fourth remembered pattern match.
$5
The fifth remembered pattern match.
$6
The sixth remembered pattern match.
$7
The seventh remembered pattern match.
$8
The eigth remembered pattern match.
$9
The ninth remembered pattern match.
constructor
The constructor method is the base method used to create an instance of the object.
global
A boolean to indicate whether or not all pattern matches should be found.
ignoreCase
A boolean to indicate that case should be ignored when patterns are matched.
input
The string to be evaluated.
lastIndex
An integer representing the character index at which to begin evaluation. This property is only applied when the global property is true.
lastMatch
The last matched characters.
lastParen
The last matched parenthesized string.
leftContext
The portion of the string that comes before the matched string.
multiline
Whether a search is to be carried out over multiple lines.
prototype
Exposes the prototype for the method or property of the object.
rightContext
The portion of the string that comes after the last character matched.
source
The pattern used by the Regular Expression object.

events