func getSuffix(fileName string) string { regex := `\.[^\.]*$` re, _ := regexp.Compile(regex) foundSuffix := re.FindString(fileName) if len(foundSuffix) <= 5 { return foundSuffix } return "" }