ReplaceRegexp replaces all matches of the compiled regexp re with the string replace. $x variables in the replace string are interpreted as by [regexp#Regexp.Expand]; for example, $1 represents the text of the first submatch.
(re *regexp.Regexp, replace string)
| 844 | // replace. $x variables in the replace string are interpreted as by |
| 845 | // [regexp#Regexp.Expand]; for example, $1 represents the text of the first submatch. |
| 846 | func (p *Pipe) ReplaceRegexp(re *regexp.Regexp, replace string) *Pipe { |
| 847 | return p.FilterLine(func(line string) string { |
| 848 | return re.ReplaceAllString(line, replace) |
| 849 | }) |
| 850 | } |
| 851 | |
| 852 | // Read reads up to len(b) bytes from the pipe into b. It returns the number of |
| 853 | // bytes read and any error encountered. At end of file, or on a nil pipe, Read |