mirror of
https://github.com/alibaba/higress.git
synced 2026-02-23 20:20:50 +08:00
21 lines
427 B
Go
21 lines
427 B
Go
package util
|
|
|
|
import regexp "github.com/wasilibs/go-re2"
|
|
|
|
func StripPrefix(s string, prefix string) string {
|
|
if len(prefix) != 0 && len(s) >= len(prefix) && s[0:len(prefix)] == prefix {
|
|
return s[len(prefix):]
|
|
}
|
|
return s
|
|
}
|
|
|
|
func MatchStatus(status string, patterns []string) bool {
|
|
for _, pattern := range patterns {
|
|
matched, _ := regexp.MatchString(pattern, status)
|
|
if matched {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|