in reply to Pattern matching forwards/backwards???

What I would do:
my $original = 'KLEWREGREG-----REGREGEWD....-EWGREGERABCSHRE..----...X +FGHWW'; my $copy = $original; $copy =~ s/[-.]+//g; if ($copy =~ /(...)XFGHWW/) { print "Found it: $1\n"; }
Of course, if there's no need to preserve the original string, there's no need to make a copy.