RegExp pattern - grouping (Definition)

Sometimes you may want to group several items to treat them conditionally or repetitively. The grouping operator provides the means to do that.


ECMAScript edition - 3

The parentheses grouping operator works inside regular expressions much as you would expect it to. Everything inside the parentheses can be operated on by a repetition. This example matches the word java or javascript:


The grouping operator is also used to delimit sub-strings.

See also:RegExp pattern, RegExp pattern - extension syntax, RegExp pattern - references, RegExp pattern - sub-patterns, RegExp.$n, RegExp.lastParen


ECMA 262 edition 3 - section - 15.10.1

ECMA 262 edition 3 - section -