my @result = $string =~ /^([^\.]\.[^\.])(:?\.([^\.]))*$/; #### my ($firstPart, @result) = split(/\./, $string); $result[0] = $firstPart . "." . $result[0];