class ActiveModel::Validations::FormatValidator
def validate_each(record, attribute, value)
def validate_each(record, attribute, value) if options[:with] regexp = option_call(record, :with) record_error(record, attribute, :with, value) unless regexp.match?(value.to_s) elsif options[:without] regexp = option_call(record, :without) record_error(record, attribute, :without, value) if regexp.match?(value.to_s) end end