... if ($line =~ /\s($reg)\s/) { my $treffer = $1; $line =~ s/$1/\($treffer\)/g; }