[May I use this opportunity to remind everyone that discussions about regexp problems are *not* appropriate for this mailing list? Please help keep this list focused on Mac specific problems and discuss regexp stuff in comp.lang.perl.misc and CGI stuff, inasmuch as it is not likely to be Mac specific, in comp.infosystems.www.authoring.cgi] bpk@hkweb.com writes: In message <3156F7C7.3E63@hkweb.com> you write: >I am trying to add a check for valid e-mail address in a form-processing CGI s o that >the user will be directed to an error message if s/he inputs something that do esn't >resemble an e-mail address. A weak version of this checks for addresses in the form of >'foo@goo.hoo': > [...] > $FORM{'email'} =~ /.+\@.+\..+/ >[...] >I would like for it to reject spaces and commas in 'foo' as well -- how would I add >this to the expression? /[^\@ \t,]+\@ ... and so on. > Is there anything else I should be checking for? Be careful about checking. Until the last X.400 advocate is strangled with the guts of the last FirstClass developer, there will always be a few extremely weird looking e-mail addresses which are actually well-formed. Depending on whether you pass on the e-mail address to an Unix mailer, checking for stuff like '|' might be necessary to prevent security breaches, though. For a definitive treatise on what is and isn't legit in addresses, check RFC 822. Matthias ----- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/~neeri "My guess is that the Internet will vanish almost as quickly as it surged into prominence. I think the Microsoft Network is going to be the Internet of 1996." -- Jeffrey Tarter, _New York Times_, 26 February 1995