Is there any way to have an expression in brackets not be caught in a group?
E.g. i have an expression something like this:
(A(B|C)?) D (E(F|G)?)
Take note of the optional blocks (B|C)?
and (F|G)?
needing brackets.
I'm not interested in what was caught in these groups. All i want is to catch the full first and last block.
But because of the optional blocks, the group numbering will change and i can't tell if (E(F|G)?)
was caught as group 2 or 3.
Can i tell the expression to ignore the optional parts in the result groups, so the group numbering will stay the same? Or can i make optional catches always appear in groups - even when they're null?