s/string replacement/regexp replacement

This commit is contained in:
Robin Walsh 2015-08-24 17:00:54 -07:00
parent 69f5abdc91
commit 8530f14fee
1 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package aws
import (
"fmt"
"math/rand"
"strings"
"regexp"
"time"
"github.com/aws/aws-sdk-go/aws"
@ -144,5 +144,6 @@ func secretAccessKeysRevoke(
}
func normalizeDisplayName(displayName string) string {
return strings.Replace(displayName, " ", "_", -1)
re := regexp.MustCompile("[^a-zA-Z+=,.@_-]")
return re.ReplaceAllString(displayName, "_")
}