use strict; my $str1 = 'Dies ist ein Text'; if ($str1 =~ m/^.*(ist).*(Tex).*/) { print "1 : '$1', 2: '$2'\n"; } if ($str1 =~ m/^.*(ein).*/) { print "1 : '$1', 2: '$2'\n"; }