JSFiddle - React, Tailwind, and code Playground

by michalmarketingmakers

JavaScript

var searchInThisString ="SomeName, First ([email protected]) SomeName2, First2 ([email protected])";

var emailRegex = /(([^<>()[\]\\.,;:\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,}))/;

var match = emailRegex.exec(searchInThisString);
console.log(match[0]);