FWIW, here's another variation. It has the advantage of producing empty strings rather than undefined values for absent pattern elements, so no need for a conversion step. It also has the advantage, if such it be, of not using named captures with the possible overhead of tied-hashery. It passes all tests above.
$string =~ m{ \A ([[:alnum:]]+?) (?= (?: \d+ [[:upper:]]{0,2})? \z) (\d*) ([[:upper:]]?) ([[:upper:]]?) \z }xms;
Give a man a fish: <%-(-(-(-<
In reply to Re^2: Question on Regular Expression
by AnomalousMonk
in thread Question on Regular Expression
by sjain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |