MCPcopy Create free account
hub / github.com/coregx/coregex / MatchReader

Method MatchReader

regex.go:1619–1630  ·  view source on GitHub ↗

MatchReader reports whether the text returned by the RuneReader contains any match of the regular expression re.

(reader io.RuneReader)

Source from the content-addressed store, hash-verified

1617// MatchReader reports whether the text returned by the RuneReader
1618// contains any match of the regular expression re.
1619func (r *Regex) MatchReader(reader io.RuneReader) bool {
1620 // Read all runes into a string and match
1621 var runes []rune
1622 for {
1623 rn, _, err := reader.ReadRune()
1624 if err != nil {
1625 break
1626 }
1627 runes = append(runes, rn)
1628 }
1629 return r.MatchString(string(runes))
1630}
1631
1632// FindReaderIndex returns a two-element slice of integers defining the
1633// location of the leftmost match of the regular expression in text read from

Callers 2

TestMatchReaderFunction · 0.80
MatchReaderFunction · 0.80

Calls 1

MatchStringMethod · 0.95

Tested by 1

TestMatchReaderFunction · 0.64