in reply to Re: About validating mail id
in thread About validating mail id

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: About validating mail id
by keszler (Priest) on Feb 03, 2010 at 13:20 UTC
    If the valid-for-your-purpose set of domains is not huge you could use something like:
    if ($mail_id =~ /\A(box1|box2|box3|other1|other2)*\.(yourcompany|other +company|elsewhere)\.com\z/ ) { print "matched\n"; }

    If you want to ensure that non-existant combinations don't occur, then:

    if ($mail_id =~ /\A(box1\.yourcompany\.com|box2\.yourcompany\.com|box3 +\.yourcompany\.com|other1\.othercompany\.com|other2\.elsewhere\.com)\ +z/ ) { print "matched\n"; }