validator
validator copied to clipboard
alphanum raising error for space characters
- [ X] I have looked at the documentation here first?
- [ X] I have looked at the examples provided that may showcase my question here?
Package version eg. v9, v10: v10
Issue, Question or Enhancement: ISSUE
blank/space is an accepted alphanumeric character, while tag alphanum is raising error for space characters
Code sample, to showcase or reproduce:
package main
import (
"fmt"
"github.com/go-playground/validator/v10"
)
func main() {
validate := validator.New()
testString := "ok testing"
errs := validate.Var(testString, "alphanum")
if errs != nil {
fmt.Println("contains err")
} else {
fmt.Println("no error")
}
}
In the ASCII character set, the space character is a non-alphanumeric printable character that is used to create space between words or other characters. Alphanumeric characters in ASCII specifically refer to the uppercase letters (A-Z), lowercase letters (a-z), and numeric digits (0-9).