feat(aa-log): improve the regex helper type.
This commit is contained in:
parent
84247e390c
commit
e3545cc3bb
4 changed files with 12 additions and 9 deletions
|
|
@ -9,6 +9,8 @@ import (
|
|||
"regexp"
|
||||
)
|
||||
|
||||
type RegexReplList []RegexRepl
|
||||
|
||||
type RegexRepl struct {
|
||||
Regex *regexp.Regexp
|
||||
Repl string
|
||||
|
|
@ -58,3 +60,10 @@ func ToRegexRepl(in []string) []RegexRepl {
|
|||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (rr RegexReplList) Replace(str string) string {
|
||||
for _, aa := range rr {
|
||||
str = aa.Regex.ReplaceAllLiteralString(str, aa.Repl)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue