gum/ansi/ansi.go

11 lines
246 B
Go
Raw Normal View History

package ansi
import "regexp"
var ansiEscape = regexp.MustCompile(`\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])`)
2023-04-12 15:57:36 +02:00
// Strip strips a string of any of it's ansi sequences.
func Strip(text string) string {
return ansiEscape.ReplaceAllString(text, "")
}