Permalink
Browse files

Merge pull request #5 from elado/master

Fixed URL Regexp
  • Loading branch information...
2 parents 477f268 + 3f6f651 commit a30e6bc4b5bc6ed183b56b7d4dc37a887ed4be93 @bbatsov committed Jul 4, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/validators/url_format_validator.rb
@@ -4,7 +4,7 @@ def validate_each(record, attribute, value)
end
def self.valid_url?(value)
- value =~ /^(?:https?:\/\/)?[a-z.0-9]+\.[a-z.]{2,}/i
+ value =~ /^((?:https?|ftp):\/\/)?(?:[^:]*:[^@]*@)?(?:(?:[^\s\.:@%#\?]+\.)+[a-z]{2,}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2}))(?:\/|$)/i
end
end

0 comments on commit a30e6bc

Please sign in to comment.