If it always starts with 7_, you can try the following:
$string = substr($text, 0, strpos($text, '_', 2));
strpos () searches for the first _, starting with character 3 (= s from the string). Then you use substr () to select the whole line, starting from the first character, to the character returned by strpos ().
source share