if ( /(BA[ABC]{2})|(CA[CD]{2})|(DA[SC]{2})/ ) { my $first = ( defined( $1 ) ? 1 : defined( $2 ) ? 2 : 3 ); ... }
local our $first; / (?: BA[ABC]{2} (?{ $first = 1; }) | CA[CD]{2} (?{ $first = 2; }) | DA[SC]{2} (?{ $first = 3; }) /x;
Update: I had mixed up (??{ }) and (?{ }). Fixed.
In reply to Re: Regex question - identify which pattern comes first
by ikegami
in thread Regex question - identify which pattern comes first
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |