RegExp pattern (Definition)

The sequence of characters that comprise a regular expression.


ECMAScript edition - 3

The rules for creating patterns are complex and involved, hence this topic has been broken into several related sub-topics.

The syntax is similar and almost as complete as that used for Perl.

A pattern is constructed using a sequence of characters. Most of the typeable characters can be used as matches for that particular character, but some special characters are used in the regular expression to mean something more abstract. Some characters need to be escaped, however they are not escaped in the same way as the normal escape sequences that are used in string literals. The literal characters are described in their own sub-topic.

There are other special character sequences, called meta-characters, that describe groups or classes of characters; these are also described in their own topic. They are called meta-characters.

You can build repetitions of literal characters and special character classes, which is also covered in a sub-topic.

See also:RegExp pattern - alternation, RegExp pattern - attributes, RegExp pattern - character class, RegExp pattern - character literal, RegExp pattern - grouping, RegExp pattern - position, RegExp pattern - references, RegExp pattern - repetition, RegExp pattern - sub-patterns, RegExp.exec(), Regular expression, String.match(), String.replace(),, String.split()


ECMA 262 edition 3 - section - 15.10.1