harangzsolt33 has asked for the wisdom of the Perl Monks concerning the following question:
Sample string: "AB ABDA DCACCB AAA BSAA CAAB ACS ABA DBA BA DASSABACA A"
I'm looking for either: BA[ABC]{2} OR CA[CD]{2} OR DA[SC]{2}
So, I would write: /BA[ABC]{2}|CA[CD]{2}|DA[SC]{2}/
Is there a way to get a return value of 1, 2, or 3 depending on which pattern was matched first? How would I do that?
|
|---|