JSFiddle - React, Tailwind, and code Playground
JavaScript
function checkIfEmailInString(text) {
var re = /(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
return re.test(text);
}
var test = "The email is [email protected]";
alert(checkIfEmailInString(test))