govalidator icon indicating copy to clipboard operation
govalidator copied to clipboard

Validate struct field error - `valid:"matches(^regex$)"` doesn't work properly

Open Springbach opened this issue 7 years ago • 2 comments

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

Springbach avatar May 29 '17 04:05 Springbach

type User struct {
	Email string `valid:"matches(^.+?@.+?\\..),required"`
	Password string `valid:"-"`
}

nsitbon avatar Jun 08 '17 08:06 nsitbon

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.

sergeyglazyrindev avatar Oct 17 '21 21:10 sergeyglazyrindev