Suppose I have a regular expression with many alternatives, such as
and it has just matched some text. I'd then like to know which of the given alternatives caused the match.
Of course I can consult
(match-string 0) to check the matched string, but I have a much more complicated situation in mind where this may not be as easy as it looks. Would there be an automatic way to do this?
I thought of grouping the alternatives and numbering them, as in
and then searching for the apropriate
(match-string n) non-nil, but I wonder if there is a better idea.