From 327a32f563394f92313e4a751515d69d90f4e7f5 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 12 Oct 2025 23:30:08 +0530 Subject: formatted code --- util/validators.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'util') diff --git a/util/validators.go b/util/validators.go index c180daf..d6eb929 100644 --- a/util/validators.go +++ b/util/validators.go @@ -18,12 +18,13 @@ package util import ( - "regexp" "net/mail" "net/url" + "regexp" ) var phoneRegex, gstinRegex *regexp.Regexp + func init() { phoneRegex = regexp.MustCompile(`^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$`) gstinRegex = regexp.MustCompile(`^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$`) @@ -34,7 +35,7 @@ func ValidateEmail(email string) bool { if err != nil { return false } - return true + return true } func ValidateWebsite(website string) bool { @@ -42,7 +43,7 @@ func ValidateWebsite(website string) bool { if err != nil { return false } - return true + return true } func ValidateGstin(gstin string) bool { @@ -50,5 +51,5 @@ func ValidateGstin(gstin string) bool { } func ValidatePhone(phone string) bool { - return phoneRegex.MatchString(phone) + return phoneRegex.MatchString(phone) } -- cgit v1.2.3