if (index($string1,"_aktuell_")>-1) { $string2 = join("_",(split("_",$string1,4))[0..2]); } else { $string2 = $string1; }