| 1881 | |
| 1882 | template <typename OutValue, typename... Ignored> |
| 1883 | OutValue Call(KernelContext*, std::string_view val, Status*) const { |
| 1884 | OutValue count = 0; |
| 1885 | re2::StringPiece input(val.data(), val.size()); |
| 1886 | auto last_size = input.size(); |
| 1887 | while (RE2::FindAndConsume(&input, *regex_match_)) { |
| 1888 | count++; |
| 1889 | if (last_size == input.size()) { |
| 1890 | // 0-length match |
| 1891 | if (input.size() > 0) { |
| 1892 | input.remove_prefix(1); |
| 1893 | } else { |
| 1894 | break; |
| 1895 | } |
| 1896 | } |
| 1897 | last_size = input.size(); |
| 1898 | } |
| 1899 | return count; |
| 1900 | } |
| 1901 | }; |
| 1902 | |
| 1903 | template <typename InputType> |