Forum: Ruby on Rails Vaidated_presence_of :email field

Posted by bdeveloper01 (Guest)
on 2011-05-26 14:29
(Received via mailing list)
This code is used to validate mail format: This is normal regular
expression format


=begin
  validates_format_of :email,
              :if => Proc.new { |employee| employee.email.nil?
employee.email.empty?},
                      :with => /^[A-Z0-9._%-]+@([A-Z0-9-]+\.)+[A-Z]
{2,4}$/i,
                      :message => "must be a valid email address"
=end


contact email: www.bdeveloper01@yahoo.com
Posted by Colin Law (Guest)
on 2011-05-26 14:39
(Received via mailing list)
On 26 May 2011 10:48, bdeveloper01 <t.bala.theni@gmail.com> wrote:
>           :message => "must be a valid email address"
> =end

Is there a question there?
If it is not working it is probably because it is commented out.

Colin
Posted by Michael Pavling (Guest)
on 2011-05-26 14:48
(Received via mailing list)
On 26 May 2011 10:48, bdeveloper01 <t.bala.theni@gmail.com> wrote:
> This code is used to validate mail format: This is normal regular
> expression format
>           :with => /^[A-Z0-9._%-]+@([A-Z0-9-]+\.)+[A-Z]
> {2,4}$/i,

What's the question? And where have you gotten this regex from...
firstly I'm confused why you're only allowing capital letters,
full-stops and underscores.... it's certainly possible to have a valid
email address with different characters than that.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.