Change validation for url: can include IPs

This commit is contained in:
chris committed 2013-02-19 17:39:42 +08:00
1 parent 2a293734c7
commit 3676de8a14
14 files changed
+14 -14

No files matched your search

@@ -27,7 +27,7 @@ class WebLink
validates :title, :at_least_one => true
before_validation :add_http
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
validates :url, :presence => true, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i
def self.search( category_id = nil )