This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
chronozinc/parsing/match.go
2016-12-06 15:37:00 +01:00

15 lines
294 B
Go

package parsing
import "regexp"
// Match tries regular expressions from the given map on the file; it returns
// the key of the first match
func Match(file []byte, dict map[string]*regexp.Regexp) string {
for key, reg := range dict {
if reg.Match(file) {
return key
}
}
return ""
}