JavaScript Pocket Reference
Anchoring match position
An anchor in a regular expression matches a position in a
string (such as the beginning or the end of the string) with-
out matching any of the characters of a string. It can be used
to restrict (or anchor) a match to a specific position within a
Versions of JavaScript
Netscape has defined a number of versions of JavaScript.
Microsoft has released more-or-less compatible versions
under the name “JScript,” and the ECMA standards body
has released three versions of a JavaScript standard named
“ECMAScript”. The following paragraphs describe these var-
ious versions, and explain how they relate to each other.
Each entry in the reference section contains availability infor-
Character Meaning
a | b Match either a or b
Group subexpression sub into a single term, and remember the text
that it matched
(?:sub) Group subexpression sub but do not number the group or
remember the text it matches (JS 1.5)
\n Match exactly the same characters that were matched by group
In replacement strings, substitute the text that matched the nth
Character Meaning
^, $ Require match at beginning/end of a string, or in multiline mode,
beginning/end of a line
\b, \B Require match at a word boundary/non-boundary
(?=p) Look-ahead assertion: require that the following characters match
the pattern p, but do not include them in the match. (JS 1.5)
(?!p) Negative look-ahead assertion: require that the following characters
do not match the pattern p. (JS 1.5)
The JavaScript Language
mation that documents the version of JavaScript in which a
feature was introduced.
JavaScript 1.0
The original version of the language. It was buggy and is
now essentially obsolete. Implemented by Netscape 2.
JavaScript 1.1
Introduced a true Array object; most serious bugs
resolved. Implemented by Netscape 3.
JavaScript 1.2
Introduced the
switch statement, regular expressions,
and a number of other features. Almost compliant with
ECMA v1, but has some incompatibilities. Implemented
by Netscape 4.
JavaScript 1.3
Fixed incompatibilities of JavaScript 1.2. Compliant with
ECMA v1. Implemented by Netscape 4.5.
JavaScript 1.4
Only implemented in Netscape server products.
JavaScript 1.5
Introduced exception handling. Compliant with ECMA
v3. Implemented by Mozilla and Netscape 6.
JScript 1.0
Roughly equivalent to JavaScript 1.0. Implemented by
early releases of IE 3.
JScript 2.0
Roughly equivalent to JavaScript 1.1. Implemented by
later releases of IE 3.
JScript 3.0
Roughly equivalent to JavaScript 1.3. Compliant with
ECMA v1. Implemented by IE 4.
JScript 4.0
Not implemented by any web browser.

Get JavaScript Pocket Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.