From 67446d400b1f382649ff14ee148effa12c9e67d7 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 17 Dec 2024 02:53:31 +0100 Subject: [PATCH] validators --- lib/validation/validators.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/validation/validators.go b/lib/validation/validators.go index cb04ddb..714cdaa 100644 --- a/lib/validation/validators.go +++ b/lib/validation/validators.go @@ -83,26 +83,26 @@ var Validators = map[*regexp.Regexp]func(match []string, value *generic.Value) e regexp.MustCompile(`(?i)^ISBN$`): isbnValidator, regexp.MustCompile(`(?i)^ISBN10$`): isbn10Validator, regexp.MustCompile(`(?i)^ISBN13$`): isbn13Validator, - regexp.MustCompile(`(?i)^[credit[-]?card$`): creditCardValidator, + regexp.MustCompile(`(?i)^[credit[-_]?card$`): creditCardValidator, regexp.MustCompile(`(?i)^uuid$`): uuidValidator, regexp.MustCompile(`(?i)^upperCase$`): upperCaseValidator, regexp.MustCompile(`(?i)^lowerCase$`): lowerCaseValidator, - regexp.MustCompile(`(?i)^rgb-color$`): _RGBColorValidator, - regexp.MustCompile(`(?i)^rgba-color$`): _RGBAColorValidator, - regexp.MustCompile(`(?i)^hex-color$`): _HEXColorValidator, + regexp.MustCompile(`(?i)^rgb[-_]?color$`): _RGBColorValidator, + regexp.MustCompile(`(?i)^rgba[-_]?color$`): _RGBAColorValidator, + regexp.MustCompile(`(?i)^hex[-_]?color$`): _HEXColorValidator, regexp.MustCompile(`(?i)^hex$`): _HEXValidator, - regexp.MustCompile(`(?i)^country-alpha-2$`): _CountryAlpha2Validator, - regexp.MustCompile(`(?i)^country-alpha-3`): _CountryAlpha3Validator, - regexp.MustCompile(`(?i)^btc_address`): _BTCAddressValidator, - regexp.MustCompile(`(?i)^eth_address`): _ETHAddressValidator, + regexp.MustCompile(`(?i)^country[-_]?alpha[-_]?2$`): _CountryAlpha2Validator, + regexp.MustCompile(`(?i)^country[-_]?alpha[-_]?3`): _CountryAlpha3Validator, + regexp.MustCompile(`(?i)^btc[-_]?address`): _BTCAddressValidator, + regexp.MustCompile(`(?i)^eth[-_]?address`): _ETHAddressValidator, regexp.MustCompile(`(?i)^cron`): cronValidator, regexp.MustCompile(`(?i)^duration`): durationValidator, regexp.MustCompile(`(?i)^time$`): timestampValidator, - regexp.MustCompile(`(?i)^(unix-timestamp|unix-ts)$`): unixTimestampValidator, + regexp.MustCompile(`(?i)^(unix[-_]?timestamp|unix[-_]?ts)$`): unixTimestampValidator, regexp.MustCompile(`(?i)^timezone$`): timezoneValidator, regexp.MustCompile(`(?i)^e164$`): e164Validator, - regexp.MustCompile(`(?i)^safe-html`): safeHTMLValidator, - regexp.MustCompile(`(?i)^no-html$`): noHTMLValidator, + regexp.MustCompile(`(?i)^safe[-_]?html`): safeHTMLValidator, + regexp.MustCompile(`(?i)^no[-_]?html$`): noHTMLValidator, regexp.MustCompile(`(?i)^phone$`): phoneValidator, }