// MatchString test a string against the glob
503258
func (g *GlobPath) MatchString(path string) bool {
	if !g.HasSuperMeta {
		res, _ := filepath.Match(g.path, path)
		return res
	}
	return g.g.Match(path)
}
703649
func Glob(path string, pattern string) (matches []string, err error) {
	err = filepath.Walk(path, func(path string, info os.FileInfo, e error) error {
		if e == nil {
			if info.IsDir() {
				if filenames, e := filepath.Glob(filepath.Join(path, pattern)); e == nil {
					matches = append(matches, filenames...)
				}
			}
		}
		return e
	})
	return
}
1095067
func MatchesMap(buf []byte, matchers matchers.Map) bool {
	return MatchMap(buf, matchers) != types.Unknown
}
83459
func MatchMap(buf []byte, matchers matchers.Map) types.Type {
	for kind, matcher := range matchers {
		if matcher(buf) {
			return kind
		}
	}
	return types.Unknown
}
552878
func MatchFold(source, target string) bool {
	return match(source, target, unicode.ToLower)
}
857743
func SearchStrings(a []string, x string) int {
	return Search(len(a), func(i int) bool { return a[i] >= x })
}
1060351
func (w *Wildmatch) Match(t string) bool {
	dirs, ok := w.consume(t, MatchOpts{})
	if !ok {
		return false
	}
	return len(dirs) == 0
}
332763
func matchPattern(pattern string) func(name string) bool {
	re := regexp.QuoteMeta(pattern)
	re = strings.Replace(re, `\.\.\.`, `.*`, -1)
	// Special case: foo/... matches foo too.
	if strings.HasSuffix(re, `/.*`) {
		re = re[:len(re)-len(`/.*`)] + `(/.*)?`
	}
	reg := regexp.MustCompile(`^` + re + `$`)
	return func(name string) bool {
		return reg.MatchString(name)
	}
}
523941
func (m unitMatcher) matchString(s string) bool {
	for _, pattern := range m.patterns {
		ok, err := path.Match(pattern, s)
		if err != nil {
			// We validate patterns, so should never get here.
			panic(fmt.Errorf("pattern syntax error in %q", pattern))
		} else if ok {
			return true
		}
	}
	return false
}
1174232
func applyString(src string, target *string) bool {
	if src != "" {
		*target = src
		return true
	}
	return false
}
1088307
func ContainsString(array []string, element string) bool {
	for _, e := range array {
		if element == e {
			return true
		}
	}
	return false
}
289078
func glob(fs http.FileSystem, dir, pattern string, matches []string) (m []string, e error) {
	m = matches
	fi, err := vfsutil.Stat(fs, dir)
	if err != nil {
		return
	}
	if !fi.IsDir() {
		return
	}
	fis, err := vfsutil.ReadDir(fs, dir)
	if err != nil {
		return
	}

	sort.Sort(byName(fis))

	for _, fi := range fis {
		n := fi.Name()
		matched, err := path.Match(path.Clean(pattern), n)
		if err != nil {
			return m, err
		}
		if matched {
			m = append(m, path.Join(dir, n))
		}
	}
	return
}
1006907
func (c *Constraint) Match(whats ...string) bool {
	var match bool

	// full string match
	for _, what := range whats {
		// case insensitive compare
		if strings.EqualFold(c.exp, what) {
			match = true
			break
		}
	}

	switch c.operator {
	case eq:
		return match
	case noteq:
		return !match
	}

	return false
}
536958
func wildmatchToString(ps ...Pattern) []string {
	s := make([]string, 0, len(ps))
	for _, p := range ps {
		s = append(s, p.String())
	}

	return s
}
1174888
func FindFirstMatchingFile(glob string) (string, error) {
	matches, err := filepath.Glob(glob)
	if err != nil {
		return "", err
	}
	if len(matches) >= 1 {
		return matches[0], nil
	}
	return "", nil
}
1263038
func matchFunc(a, b string) bool {
	matched, _ := regexp.MatchString(b, a)
	return matched
}
319463
func (re *Regexp) FindStringMatch(s string) (*Match, error) {
	// convert string to runes
	return re.run(false, -1, getRunes(s))
}