c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'eks---wye'; ;; my $found = my ($x, $y) = $s =~ m{ \A (eks) .* (wye) \z }xms; if ($found) { print qq{A: found '$x' and '$y'}; } else { print 'A: found nada'; } ;; $s = uc $s; ;; if (my ($xx, $yy) = $s =~ m{ (EKS) .* (WYE) }xms) { print qq{B: found '$xx' and '$yy'}; } else { print 'B: found nada'; } " A: found 'eks' and 'wye' B: found 'EKS' and 'WYE'