#! perl use strict; use warnings; my @strings = ('ECX3', 'ABC3X 98', 'A B3X 28.5'); for (@strings) { print "$1\n" if /([a-zA-Z]{1,2})/; } #### 13:13 >perl 633_SoPW.pl EC AB A 13:13 >