Skip to content

Instantly share code, notes, and snippets.

@simmo
Created September 13, 2011 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simmo/1213794 to your computer and use it in GitHub Desktop.
Save simmo/1213794 to your computer and use it in GitHub Desktop.
Domain Regex
class Website < ActiveRecord::Base
validates :domain, :format => { :with => /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment