/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/test/util.go
11 строк
478 B
Stephen Benjamin
Strip ANSI control characters from junits
15 мар 2023, 19:10
15 мар 2023, 19:10
68e7c64
Код
Авторство
О чём код?
package test import "regexp" // ansiRegex contains a regex for stripping out ANSI control sequences. See https://github.com/acarl005/stripansi/blob/master/stripansi.go var ansiRegex = regexp.MustCompile("[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))") // StripANSI removes ANSI control sequences from a string. func StripANSI(s []byte) []byte { return ansiRegex.ReplaceAll(s, []byte("")) }