Here’s a minimal case,
I have multiple regex, that is aa, bb, and cc, in the old days, I just loop through all regex and see if the string can match any of those. If any regex got matched, stop the process.
But now I decided to put it altogether, with a simple OR operation, now I get
(aa)|(bb)|(cc)
So if I get a match, the $1 would be what I wanted, but I wouldn’t be able to know if it’s (aa) or (bb) or (cc) that did it, any ideas?
In your example, if aa matched,
$1will be set; if bb matched,$1will be undef and$2will be set, etc.or, more dynamically, using
@-and@+: