Java Reference
In-Depth Information
Properties
Property
Introduced
Description
constructor
JavaScript 1.2
Used to reference the constructor function for the object.
global
JavaScript 1.2
Indicates whether all possible matches in the string are to be
made, or only the fi rst. Corresponds to the g fl ag.
ignoreCase
JavaScript 1.2
Indicates whether the match is to be case-insensitive.
Corresponds to the i fl ag.
input
JavaScript 1.2
The string against which the regular expression is matched.
lastIndex
JavaScript 1.2
The position in the string from which the next match is to be
started.
multiline
JavaScript 1.2
Indicates whether strings are to be searched across multiple
lines. Corresponds with the m fl ag.
prototype
JavaScript 1.2
Returns the prototype for the object, which can be used to
extend the object's interface.
source
JavaScript 1.2
The text of the pattern for the regular expression.
Methods
Method
Introduced
Description
exec(stringToSearch)
JavaScript 1.2
Executes a search for a match in the string param-
eter passed in.
test(stringToMatch)
JavaScript 1.2
Tests for a match in the string parameter passed in.
toString()
JavaScript 1.2
Converts the RegExp object into a string.
valueOf()
JavaScript 1.2
Returns the primitive value of the RegExp object.
Special Characters Used in Regular Expressions
Character
Examples
Function
\
/n/ matches n;
/\n/ matches a linefeed
character;
/^/ matches the start of a
line; and
/\^/ matches ^
For characters that are by default treated as normal
characters, the backslash indicates that the next char-
acter is to be interpreted with a special value.
For characters that are usually treated as special
characters, the backslash indicates that the next char-
acter is to be interpreted as a normal character.
Continued
Search WWH ::




Custom Search