例子:将字符串中的多个空格替换为一个
value = "world is very large!" reg, _ := regexp.Compile(`[\s]+`) value1 :=reg.ReplaceAllString(value, " ") fmt.Println(value1)