lot of new functionalities
This commit is contained in:
15
core/utils/form-validators/phone-numbers.go
Executable file
15
core/utils/form-validators/phone-numbers.go
Executable file
@@ -0,0 +1,15 @@
|
||||
package formvalidators
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
const phoneNumberRegexStreing = "^((\\+)33|0)[1-9](\\d{2}){4}$"
|
||||
|
||||
var phoneNumberRegex = regexp.MustCompile(phoneNumberRegexStreing)
|
||||
|
||||
func PhoneNumber(fl validator.FieldLevel) bool {
|
||||
return phoneNumberRegex.MatchString(fl.Field().String())
|
||||
}
|
||||
Reference in New Issue
Block a user