leafiy
5/18/2018 - 6:53 PM

substring email #js #regex

none

var email = "john.doe@email.com";
var name   = email.substring(0, email.lastIndexOf("@"));
var domain = email.substring(email.lastIndexOf("@") +1);