/* How to split the string and store to two variable only name and email id.*/
var str = "chris <[email protected]>"
/*expected output`enter code here`
name = "chris"
email_id = "[email protected]" */
Must remove the space and the ( "<>" )return the only string.
const match = str.match(/(.*)\s*<(.*)>/);thenmatch[1]andmatch[2]are your name and email.