You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Adrien Kara 9be10f2ad7
License typo
2 weeks ago
.gitignore Initial commit 10 months ago
LICENSE Initial commit 10 months ago
README.md License typo 2 weeks ago
go.mod Migrate the package to github 2 weeks ago
wildcard.go Fork from minio pkg 10 months ago
wildcard_test.go Update test lib import 2 weeks ago

README.md

Go-wildcard

Go Report Card Go Reference Go coverage Apache V2 License

Go-wildcard is forked from Minio project
https://github.com/minio/minio/tree/master/pkg/wildcard

Why

This part of Minio project is a very cool, fast and light wildcard pattern matching.

Originally the purpose of this fork is to give access to this "lib" under Apache license, without import the entire Minio project ...

Two function are available MatchSimple and Match

  • MatchSimple only covert * usage (he is a bit faster)
  • Match support full wildcard matching, * and ?

I know Regex, but this is a big part, and it is slow (even prepared regex) ...
I know Glob, but most of the time, I only need simple wildcard matching.

This library remains under Apache License Version 2.0, but MinIO project is migrated to GNU Affero General Public License 3.0 or later from 069432566f

How to

Using this fork

go get github.com/IGLOU-EU/go-wildcard@latest

Using Official Minio (GNU Affero General Public License 3.0 or later)

From 81d5688d56 the minio pkg are moved to https://github.com/minio/pkg

go get github.com/minio/pkg/wildcard@latest

Quick Example

This example shows a Go file which pattern matching ...

package main

import (
	"fmt"
	"log"

	wildcard "github.com/IGLOU-EU/go-wildcard"
)

func main() {
    str := "daaadabadmanda"
    
    pattern := "da*da*da*"
    result := wildcard.MatchSimple(pattern, str)
	fmt.Println(str, pattern, result)

    pattern = "?a*da*d?*"
    result = wildcard.Match(pattern, str)
	fmt.Println(str, pattern, result)
}