We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

gdonald on 09/27/06


Tagged

email validate


Versions (?)


Who likes this?

8 people have marked this snippet as a favorite

dapan
adam_dc
Jargon
bordalix
edwinjanmoss
vali29
zemariamm
acookinc


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

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

Posted By: exscape on August 26, 2007

testevilcode;@test.com passes as valid ;)

You need to login to post a comment.