MatchReader reports whether the text returned by the RuneReader contains any match of the regular expression re.
(reader io.RuneReader)
| 1617 | // MatchReader reports whether the text returned by the RuneReader |
| 1618 | // contains any match of the regular expression re. |
| 1619 | func (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 |