Google spreadsheets custom function code not working: =RootDomain -
hi trying program google spreadsheets custom function. receives range , spits out clean rootdomain. ran "too many executions" - have run on whole sheet. added range.
now feedback "internal error function" ....
help appreciated .... must possible!
/** * generates clean root domains * * @param {input} input value change root domain. * @return clean root domain. * @rootdomain */ function rootdomain(input) { if (input == null) return ''; if (input.map) { // test whether input array. return input.map(rootdomain); // recurse on array if so. } else { if (input = '') return ''; regex = new regexp(/((www)\.)?.*(\w+)\.([\w\.]{2,6})/); return regex.exec(input)[0].replace(/^http(s)?:\/\//i, "").replace(/^www\./i, "").replace(/\/.*$/, ""); } }
do instead:
function rootdomain(input) { if (input == null || input === '') { return ''; } else if (input.map) { // test whether input array. return input.map(rootdomain); // recurse on array if so. } var regex = new regexp(/((www)\.)?.*(\w+)\.([\w\.]{2,6})/); return regex.exec(input)[0].replace(/^http(s)?:\/\//i, "").replace(/^www\./i, "").replace(/\/.*$/, ""); }
Comments
Post a Comment