govalidator
govalidator copied to clipboard
Validate struct field error - `valid:"matches(^regex$)"` doesn't work properly
Example
type User struct {
Email string valid:"matches(^.+\@.+\..+$)"
Password string valid:"-"
}
_, err := govalidator.ValidateStruct(user) if err != nil { log.Println(err.Error()) }
regex doesnt work properly. It matches all strings
type User struct {
Email string `valid:"matches(^.+?@.+?\\..),required"`
Password string `valid:"-"`
}
Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.