in reply to Re: Regex question - identify which pattern comes first (named captures)
in thread Regex question - identify which pattern comes first

Adjusted for OP:

if ( $str =~ / (?: (?<_1> BA[ABC]{2} ) | (?<_2> CA[CD]{2} ) | (?<_3> DA[SC]{2} ) /x ) { my $first = substr( ( keys( %+ ) )[0], 1 ); ... }
  • Comment on Re^2: Regex question - identify which pattern comes first (named captures)
  • Download Code

Replies are listed 'Best First'.
Re^3: Regex question - identify which pattern comes first (named captures)
by LanX (Saint) on May 03, 2026 at 21:29 UTC