Sha256: 98a01c13c5f80e70997d93866e6fed63de209c33bdf4b6f1d8433c8f0b6a0663
Contents?: true
Size: 583 Bytes
Versions: 4
Compression:
Stored size: 583 Bytes
Contents
# frozen_string_literal: true module Openapi3Parser module Validators class Email # Regex is sourced from HTML specification: # https://html.spec.whatwg.org/#e-mail-state-(type=email) REGEX = %r{ \A [a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+ @ [a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])? (?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)* \Z }x.freeze def self.call(input) message = %("#{input}" is not a valid email address) message unless REGEX.match(input) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems