[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] grep for valid Internet e-mail address



I am trying to add a check for valid e-mail address in a form-processing CGI so that 
the user will be directed to an error message if s/he inputs something that doesn't 
resemble an e-mail address. A weak version of this checks for addresses in the form of 
'foo@goo.hoo':

   unless ($FORM{'email'} =~ /.+\@.+\..+/) {
           print "Location: http://server.com/error.html\n\n";
   }
   else {

   print "Location: http://server.com/confirm.html\n\n";
   }

I would like for it to reject spaces and commas in 'foo' as well -- how would I add 
this to the expression? Is there anything else I should be checking for?

--
Brian Kariger
bpk@nothing.com