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-/E1597aS9LQAvxtiuMwx3w@public.gmane.org -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 May 2011 10:48, bdeveloper01 <t.bala.theni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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" > =endIs there a question there? If it is not working it is probably because it is commented out. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 May 2011 10:48, bdeveloper01 <t.bala.theni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.