carmelyne (owner)

Revisions

gist: 64587 Download_button fork
public
Public Clone URL: git://gist.github.com/64587.git
Embed All Files: show embed
Rails validates_format_of #
1
2
3
4
5
6
7
8
# 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)