HTML and CSS Reference
Metacharacters and Metasymbols (continued)
What It Matches
Matches x but does not remember the match. These are called
noncapturing parentheses. The matched substring cannot be recalled
from the resulting array's elements  , ..., [n] or from the predefined
RegExp object's properties $1, ..., $9 .
Matches x only if x is followed by y . For example, /Jack(?=Sprat)/
matches Jack only if it is followed by Sprat . /Jack(?=Sprat|Frost)/
matches Jack only if it is followed by Sprat or Frost . However, neither
Sprat nor Frost are part of the match results.
Matches x only if x is not followed by y . For example, /\d+(?!\.)/
matches a number only if it is not followed by a decimal point.
/\d+(?!\.)/.exec("3.141") matches 141 but not 3.141 .
If you are searching for a particular character within a regular expression, you can use
the dot metacharacter to represent a single character, or a character class that matches
on one character from a set of characters. In addition to the dot and character class, Java-
Script has added some backslashed symbols (called metasymbols) to represent single
characters. See Table 17.7 for the single-character metacharacters, and Table 17.8 on
page 742 for a list of metasymbols.
Table 17.7 Single-Character and Single-Digit Metacharacters
What It Matches
Matches any character except newline.
Matches any single character in set.
Matches any single character not in set.
The dot metacharacter matches for any single character with the exception of the new-
line character. For example, the regular expression /a.b/ is matched if the string contains
an a , followed by any one single character (except the \n ), followed by b , whereas the
expression /.../ matches any string containing at least three characters.