my $text = 'Irgendwas anderes'; my $string = "irgendein text http://test.example _wort_ noch was"; $string =~ s!(http://.*?)\s!$text !g; print $string;