github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/validators/gender.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package validators
     4  
     5  import (
     6  	"regexp"
     7  )
     8  
     9  const (
    10  	// GenderPattern : Regular expression of gender.
    11  	GenderPattern = `^(Male|Female|Gay|Lesbian|Bisexual|Asexual|Other)$`
    12  )
    13  
    14  // Gender : Validate a gender code.
    15  func Gender(gender string) bool {
    16  	match, _ := regexp.MatchString(GenderPattern, gender)
    17  	return match
    18  }