#!/usr/bin/env js

var email = " hogehoge@example.com  \n";

var localpart = "", domainpart ="";
  if (email.match(/\s*(\S+?)@([^@]+)\s*/)) {
    localpart  = RegExp.$1;
    domainpart = RegExp.$2;
  }

print("email="+email+", localpart="+localpart+", domainpart="+domainpart);
