ROR常用正则表达式

Valid email? Validate email addresses in Rails!

# our User model
class User < ActiveRecord::Base
  validates_presence_of :email
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
end
 

你可能感兴趣的:(正则表达式,Rails,ActiveRecord)