A Go package for glob matching
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE Create LICENSE Feb 9, 2017
README.md Add godoc tag Feb 9, 2017
glob.go Merge Feb 9, 2017
glob_test.go Don't allow globs to match part of the input Feb 8, 2017

README.md

String globbing in Go

GoDoc

This package adds support for globs in Go.

It simply converts glob expressions to regexps. I try to follow the standard defined here.

Example

package main

import "github.com/zyedidia/glob"

func main() {
    glob, err := glob.Compile("{*.go,*.c}")
    if err != nil {
        // Error
    }

    glob.Match([]byte("test.c"))   // true
    glob.Match([]byte("hello.go")) // true
    glob.Match([]byte("test.d"))   // false
}

You can call all the same functions on a glob that you can call on a regexp.