in match/matchers.go [164:210]
func (m *prefixNumDate) Match(in []byte) bool {
if len(in) < m.minLen {
return false
}
pos := 0
if m.prefix != nil {
end := len(m.prefix)
if !bytes.Equal(in[0:end], m.prefix) {
return false
}
pos += end
}
for cnt := m.digits[0]; cnt > 0; cnt-- {
v := in[pos]
pos++
if !('0' <= v && v <= '9') {
return false
}
}
for i := 1; i < len(m.digits); i++ {
sep := m.seps[i-1]
if !bytes.Equal(in[pos:pos+len(sep)], sep) {
return false
}
pos += len(sep)
for cnt := m.digits[i]; cnt > 0; cnt-- {
v := in[pos]
pos++
if !('0' <= v && v <= '9') {
return false
}
}
}
if sfx := m.suffix; len(sfx) > 0 {
if !bytes.HasPrefix(in[pos:], sfx) {
return false
}
}
return true
}