Documentation ¶
Index ¶
- type RegexpTransformer
- func Regexp(re *regexp.Regexp, new []byte) RegexpTransformer
- func RegexpFunc(re *regexp.Regexp, replace func([]byte) []byte) RegexpTransformer
- func RegexpString(re *regexp.Regexp, new string) RegexpTransformer
- func RegexpStringFunc(re *regexp.Regexp, replace func(string) string) RegexpTransformer
- func RegexpStringSubmatchFunc(re *regexp.Regexp, replace func([]string) string) RegexpTransformer
- func RegexpSubmatchFunc(re *regexp.Regexp, replace func([][]byte) []byte) RegexpTransformer
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RegexpTransformer ¶ added in v0.2.0
type RegexpTransformer struct { transform.NopResetter // MaxSourceBuffer is the maximum size of the window used to search for the // regex match. (Default is 64kb). MaxSourceBuffer int // contains filtered or unexported fields }
RegexpTransformer replaces regexp matches in a stream See: http://golang.org/x/text/transform
func Regexp ¶ added in v0.2.0
func Regexp(re *regexp.Regexp, new []byte) RegexpTransformer
Regexp returns a transformer that replaces all matches of re with new
func RegexpFunc ¶ added in v0.2.0
func RegexpFunc(re *regexp.Regexp, replace func([]byte) []byte) RegexpTransformer
RegexpFunc returns a transformer that replaces all matches of re with the result of calling replace with the match. Replace may be called with the same match multiple times.
func RegexpString ¶ added in v0.2.0
func RegexpString(re *regexp.Regexp, new string) RegexpTransformer
RegexpString returns a transformer that replaces all matches of re with new
func RegexpStringFunc ¶ added in v0.2.0
func RegexpStringFunc(re *regexp.Regexp, replace func(string) string) RegexpTransformer
RegexpStringFunc returns a transformer that replaces all matches of re with the result of calling replace with the match. Replace may be called with the same match multiple times.
func RegexpStringSubmatchFunc ¶ added in v0.2.0
func RegexpStringSubmatchFunc(re *regexp.Regexp, replace func([]string) string) RegexpTransformer
RegexpStringSubmatchFunc returns a transformer that replaces all matches of re with the result of calling replace with the submatch. Replace may be called with the same match multiple times.
func RegexpSubmatchFunc ¶ added in v0.2.0
func RegexpSubmatchFunc(re *regexp.Regexp, replace func([][]byte) []byte) RegexpTransformer
RegexpSubmatchFunc returns a transformer that replaces all matches of re with the result of calling replace with the submatch. Replace may be called with the same match multiple times.
type Transformer ¶
type Transformer struct { transform.NopResetter // contains filtered or unexported fields }
Transformer replaces text in a stream See: http://golang.org/x/text/transform
func Bytes ¶
func Bytes(old, new []byte) Transformer
Bytes returns a transformer that replaces all instances of old with new. Unlike bytes.Replace, empty old values don't match anything.
func String ¶
func String(old, new string) Transformer
String returns a transformer that replaces all instances of old with new. Unlike strings.Replace, empty old values don't match anything.