Thursday, May 15, 2008

Grab User and domain name from email address


Share at Facebook

How to grab the user id and the domain name from the email address? There are many ways to do this. I'm giving an example of using Perl and regular expression.

my $email = 'ronaldo@fifa.com';
my ($id, $domain) = $email =~ /(.*)\@(.*)/g;
print "$id\n$domain\n";
If anyone knows other ways, welcome to post as a comment.




No comments: