in reply to Pattern matching forwards/backwards???

We can use split with a regex to get the second last string 1 and then apply another regex to get the last three characters in the second last string1
#!/usr/bin/perl use strict; my $string = "KLEWREGREG-----REGREGEWD....-EWGREGERABCSHRT..----...XFG +HWW....----....TRYU"; my @array = split ("[.-]+",$string); my $interested = $array[$#array-1]; print $1 if ( $interested =~ m/([a-zA-Z]{3}$)/); Output : HWW