Published in: Ruby
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'email must be valid'
Comments
Subscribe to comments
You need to login to post a comment.
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.
gdonald on 09/27/06
8 people have marked this snippet as a favorite
dapan
adam_dc
Jargon
bordalix
edwinjanmoss
vali29
zemariamm
acookinc
Published in: Ruby
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'email must be valid'
Subscribe to comments
You need to login to post a comment.
... but snipplr is smart enough to filter it. There are HTML script tags around the evilcode.
testevilcode;@test.com passes as valid ;)