I would like to know if anyone knows a solution for excluding a group within a group in a regular expression. For example:
/(name|(?:last[ ])name|(?:first[ ])name)/i
I would only like the word "name" to be returned (this is just an example), but when I take match number 1 (matched against "last name"), I get "last name" instead of just "name", even though I used "?:" in the capture group. I think it's because I didn't use "?:" in the first group, so therefore I would like to know: is it possible to achieve what I would like to achieve?