my $string = '~Foobar§http://test.de~'; my $linksign = '~'; my $delimiter = '§'; $string =~ s!$linksign([^$delimiter]+)$delimiter([^$delimiter]+)$linksign!$1!g; print $string,"\n";