Skip to content

Instantly share code, notes, and snippets.

@carmelyne
Created February 15, 2009 03:25
Show Gist options
  • Save carmelyne/64587 to your computer and use it in GitHub Desktop.
Save carmelyne/64587 to your computer and use it in GitHub Desktop.
# email
validates_format_of :email, :with => /(^([^@\s]+)@((?:[-_a-z0-9]+\.)+[a-z]{2,})$)|(^$)/i
# url
validates_format_of :url, :with => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
# password
validates_format_of :password, :with => /^\w+$/ (alphanumeric)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment