Posted By

gdonald on 09/27/06


Tagged

email validate


Versions (?)

Who likes this?

15 people have marked this snippet as a favorite

dapan
adam_dc
Jargon
bordalix
edwinjanmoss
vali29
zemariamm
acookinc
batamire
webstic
davidsi
jallen7usa
schroedinger
painteddigital
concertman


Rails validate email


 / Published in: Ruby
 

  1. validates_format_of :email,
  2. :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,
  3. :message => 'email must be valid'

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: exscape on August 26, 2007

testevilcode;@test.com passes as valid ;)

Posted By: exscape on August 26, 2007

... but snipplr is smart enough to filter it. There are HTML script tags around the evilcode.

Posted By: karudzo on December 23, 2010

This one works well actually.

You need to login to post a comment.