" . $search . "", $tok); $text .= sprintf("\n"); $tok = strtok("\n"); } echo $text; //echo preg_replace("/^(some text)/", "some text", $str); ?>