MatchRegexp produces only the input lines that match the compiled regexp re.
(re *regexp.Regexp)
| 796 | |
| 797 | // MatchRegexp produces only the input lines that match the compiled regexp re. |
| 798 | func (p *Pipe) MatchRegexp(re *regexp.Regexp) *Pipe { |
| 799 | return p.FilterScan(func(line string, w io.Writer) { |
| 800 | if re.MatchString(line) { |
| 801 | fmt.Fprintln(w, line) |
| 802 | } |
| 803 | }) |
| 804 | } |
| 805 | |
| 806 | // Post makes an HTTP POST request to url, using the contents of the pipe as |
| 807 | // the request body, and produces the server's response. See [Pipe.Do] for how |