1package tfe 2 3import ( 4 "regexp" 5) 6 7// A regular expression used to validate common string ID patterns. 8var reStringID = regexp.MustCompile(`^[a-zA-Z0-9\-\._]+$`) 9 10// validString checks if the given input is present and non-empty. 11func validString(v *string) bool { 12 return v != nil && *v != "" 13} 14 15// validStringID checks if the given string pointer is non-nil and 16// contains a typical string identifier. 17func validStringID(v *string) bool { 18 return v != nil && reStringID.MatchString(*v) 19} 20