Sha256: 00f89f852f4ed90e0f77610e9db76af39d255b6b916dc98e7db31ce6694fab6b
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
module Validators EMAIL_FORMAT = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i # Source: https://github.com/henrik/validates_url_format_of IPv4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255 if RUBY_VERSION >= "1.9" URL_FORMAT = %r[ \A https?:// # http:// or https:// ([^\s:@]+:[^\s:@]*@)? # optional username:pw@ ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)... #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4 (:\d{1,5})? # optional port ([/?]\S*)? # optional /whatever or ?whatever \Z ]ixs else URL_FORMAT = %r[ \A https?:// # http:// or https:// ([^\s:@]+:[^\s:@]*@)? # optional username:pw@ ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)... #{IPv4_PART}(\.#{IPv4_PART}){3} ) # or IPv4 (:\d{1,5})? # optional port ([/?]\S*)? # optional /whatever or ?whatever \Z ]ixu end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
validators-1.0.0 | lib/validators/constants.rb |
validators-0.1.3 | lib/validators/constants.rb |
validators-0.1.2 | lib/validators/constants.rb |
validators-0.1.1 | lib/validators/constants.rb |