Skip to content

Commit

Permalink
Alphanumeric, not just letters
Browse files Browse the repository at this point in the history
  • Loading branch information
abayer committed Mar 5, 2019
1 parent bcc3e55 commit 79cdb9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/names/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func (simpleNameGenerator) RestrictLength(base string) string {
if len(base) > maxNameLength {
base = base[:maxNameLength]
}
var isLetter = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString
var isAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString

for !isLetter(base[len(base)-1:]) {
for !isAlphaNumeric(base[len(base)-1:]) {
base = base[:len(base)-1]
}
return base
Expand Down

0 comments on commit 79cdb9b

Please sign in to comment.