Next: , Previous: List Operators, Up: Common Operators

13.3.7 Grouping Operators (( ... ) 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:

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 ‘)’.