Stumbled on this:
validates_format_of :domain_name, :with => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix
FYI: Rubular is a fantastic resource for testing your Ruby regular expressions
More Related Contents:
- Why does String#gsub double content?
- Rails: What’s a good way to validate links (URLs)?
- How to match accented characters with a regex?
- Explain like I'm LITERALLY five…what does it mean to "format" a string? [closed]
- Understanding the Rails Authenticity Token
- What is the best method of handling currency/money?
- form_for with nested resources
- Why do routes with a dot in a parameter fail to match?
- Installing Bootstrap 3 on Rails App
- Rails 4 Authenticity Token
- When to use a “has_many :through” relation in Rails?
- usage of attr_accessor in Rails
- Change from SQLite to PostgreSQL in a fresh Rails project
- Getting the warning “Insecure world writable dir /home/chance ” in PATH, mode 040777 for rails and gem
- How does Rails ActiveRecord chain “where” clauses without multiple queries?
- How to test for (ActiveRecord) object equality
- What is the best way to seed a database in Rails?
- Connecting to multiple databases in ruby on rails
- ‘require’: cannot load such file — ‘nokogiri\nokogiri’ (LoadError) when running `rails server`
- What are the brackets [5.1] after ActiveRecord Migration and how does it work? [duplicate]
- f.error_messages in Rails 3.0
- Rails Paperclip how to delete attachment?
- Scope with join on :has_many :through association
- Rails Migrations: tried to change the type of column from string to integer
- Adding extra registration fields with Devise
- Rails 4 – checkboxes for has_and_belongs_to_many association
- Rails 4: Why are fonts not loading in production?
- String.force_encoding() in Ruby 1.8.7 (or Rails 2.x)
- unable to install pg gem
- ActionController::ParameterMissing (param is missing or the value is empty: film):