Hello, what is the easiest way to parse email addresses when the structure is [email protected] to receive separate values of “name” and “subdomain”.
Tried CODE NODE and Javascript node, tried MATCH and regex. Both are quite complicated and failed to use it.
Anyone did this recently and succeeded?
Update:
Worked this “Code Node” javascript code, just now solving an issue how to replace it with a value from node before:
var email = '[email protected]';
var found = email.match(/^(.*)@(.*?)\.([^.]+)$/);
var obj = {};
if (found && found.length === 4) {
obj['ID'] = found[1];
obj['slogan'] = found[2].split('.')[0];
}
return obj;