You can either remove everything you don't want, or keep only those things you want to keep;
$sString="hello, this is a string.";
// Remove what you don't want
echo preg_replace("/[.,]/", ' ', $sString);
// or keep what you do want
echo preg_replace("/[a-zA-Z]/", ' ', $sString);
exit;
"but then add it back in the same relative"
You would ofcourse make a copy of the origal string, remove the punctuation, check it, and then continue processing with another copy of the original string.