you are in: codestackercodes [RSS] → tag: regex [RSS]

validation sample Delicious

show/hide lines
   1  validates_format_of :company_url, :with => /((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?)/ # valida URL
   2  validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create, :message=>"has an invalid format" 
   3  validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'email must be valid'
   4  validates_format_of :login, :with => /\w+@\w+\.\w{2}/
   5  
created by anonymous — 17 June 2008 — get a short url — tags: rails regex validation embed