I know that capture-parenthesed subexpressions is counted in back reference numbering even when they’re in an optional part that don’t match, but what about when they’re in a branch of an alternation? Will (adam)|(eve) give adam in \1 or eve in \2, or adam or eve in \1?
Are all capturing-parenthes still counted from left to right or do these two count as one in the numbering? If so, what happens when you have a different number of captures in the choices, like (god)|(adam)&(eve)?
I want to capture a value with either ”, “” or nothing around it, and this is what i have:
(['"])(.*?)\1|([^'"]+)
The back-references count the amount of parenthesis, regardless of how many of them have been matched.
So, in
(god)|(adam)&(eve):See here: http://jsfiddle.net/MnASH/