funcmain() { var re = regexp.MustCompile(`([^=]*)=(.*)`) var str = `cfg:/etc/config/a.conf = 0 Build=20160331 Version = 2.2.13 Date = 2016-06-28 RC_Number = 181 Enable= Status = complete ePassword = [email protected]+yXOlw== Server Type = 5 Check External IP = 10 Enable = TRUEÅ` for i, match := range re.FindAllString(str, -1) { fmt.Println(match, "found at index", i) } }