MCPcopy
hub / github.com/bitfield/script / MatchRegexp

Method MatchRegexp

script.go:798–804  ·  view source on GitHub ↗

MatchRegexp produces only the input lines that match the compiled regexp re.

(re *regexp.Regexp)

Source from the content-addressed store, hash-verified

796
797// MatchRegexp produces only the input lines that match the compiled regexp re.
798func (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

Calls 1

FilterScanMethod · 0.95