Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/data_mapper/validation/rule/formats/url.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# encoding: utf-8

require 'uri'

module DataMapper
module Validation
class Rule
module Formats

# Regex from http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/
Url = begin
/(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((\:[0-9]{1,5})?\/?.*)?$)/ix
URI.regexp(['http','https'])
end

end # module Formats
Expand Down