Next: The Back-reference Operator (\digit), Previous: List Operators ([
… ]
and [^
… ]
), Up: Common Operators [Contents][Index]
(
… )
or \(
… \)
)A group, also known as a subexpression, consists of an open-group operator, any number of other operators, and a close-group operator. Regex treats this sequence as a unit, just as mathematics and programming languages treat a parenthesized expression as a unit.
Therefore, using groups, you can:
|
or \|
)) or a repetition operator (see Repetition Operators).
If the syntax bit RE_NO_BK_PARENS
is set, then ‘(’ represents
the open-group operator and ‘)’ represents the
close-group operator; otherwise, ‘\(’ and ‘\)’ do.
If the syntax bit RE_UNMATCHED_RIGHT_PAREN_ORD
is set and a
close-group operator has no matching open-group operator, then Regex
considers it to match ‘)’.