I can't seem to find the right function to search a string. I want to grab the email out of the error code and then display that to the user but the function I am using returns everything after the string is found also. What function can I use to only return what I am looking for?

The output of the below code is user@email.com' for key 'PRIMARY' has already been registered. I only want user@email.com returned.

PHP Code:
                //Grabs the error message
$errorMessage mysqli_error($dbConnect);
//grabs the email from the error mesage
$usedEmail strstr($errorMessage$email);
// tells users email has already been used.
$regMessage $usedEmail " has already been registered"