I am attempting to extract Smith
from name
into lastName
.
function reggie(){
var name = "JohnSmith";
var first = "John";
var regExp = new RegExp("(?:"+first+")(w+)", "gi");
var lastName = regExp.exec(name);
//Logger.log(lastName); // in google apps
console.log(lastName);
}
reggie()