{"id":13413978,"url":"https://github.com/IGLOU-EU/go-wildcard","last_synced_at":"2025-03-14T20:30:49.776Z","repository":{"id":43057737,"uuid":"352380506","full_name":"IGLOU-EU/go-wildcard","owner":"IGLOU-EU","description":"🚀 Fast and light wildcard pattern matching.","archived":false,"fork":false,"pushed_at":"2025-02-11T12:51:58.000Z","size":138,"stargazers_count":84,"open_issues_count":8,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-14T17:45:44.241Z","etag":null,"topics":["go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IGLOU-EU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T16:31:41.000Z","updated_at":"2025-03-03T11:56:23.000Z","dependencies_parsed_at":"2024-06-18T15:48:33.957Z","dependency_job_id":"9f37218c-94a2-44b5-a931-f1d4df5f5110","html_url":"https://github.com/IGLOU-EU/go-wildcard","commit_stats":null,"previous_names":["iglou-eu/go-wilcard"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGLOU-EU%2Fgo-wildcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGLOU-EU%2Fgo-wildcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGLOU-EU%2Fgo-wildcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGLOU-EU%2Fgo-wildcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IGLOU-EU","download_url":"https://codeload.github.com/IGLOU-EU/go-wildcard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243642012,"owners_count":20323949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang"],"created_at":"2024-07-30T20:01:54.266Z","updated_at":"2025-03-14T20:30:49.764Z","avatar_url":"https://github.com/IGLOU-EU.png","language":"Go","funding_links":[],"categories":["Template Engines","Text Processing","文本处理","Bot Building","Specific Formats"],"sub_categories":["Regular Expressions","正则表达式","HTTP Clients"],"readme":"# Go-wildcard\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/IGLOU-EU/go-wildcard/v2)](https://goreportcard.com/report/github.com/IGLOU-EU/go-wildcard/v2)\n[![Go Reference](https://img.shields.io/badge/api-reference-blue)](https://pkg.go.dev/github.com/IGLOU-EU/go-wildcard/v2)\n[![BSD 3 Clause ](https://img.shields.io/badge/license-BSD_3_Clause-blue)](https://opensource.org/license/bsd-3-clause/)\n\n## 💡 Why\nThe purpose of this library is to provide a simple and fast wildcard pattern matching.\nRegex are much more complex and slower (even prepared regex)... and the filepath.Match is file-name-centric.\n\nSo, this library is a very fast and very simple alternative to regex and not tied to filename semantics unlike filepath.Match. \nThere are no dependencies and is alocation free. 🥳\n\n## 🧰 Features\nThere are the supported patterns operators:\n- `*` match zero or more characters\n- `?` match zero or one character\n- `.` match exactly one character\n\n## 🧐 How to\n\u003e⚠️ WARNING: Unlike the GNU \"libc\", this library have no equivalent to \"FNM_FILE_NAME\". \n\u003eTo do this you can use \"path/filepath\" https://pkg.go.dev/path/filepath#Match\n\nThere is super simple to use this library, you just have to import it and use the Match function.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/IGLOU-EU/go-wildcard/v2\"\n)\n\nfunc main() {\n    str := \"daaadabadmanda\"\n    pattern := \"?a*da*d.?*\"\n\n    resultM := wildcard.Match(pattern, str) // Fastest way but can't use '?' or '.\" with rune multiple byte representation\n    resultMFB = wildcard.MatchFromByte([]byte(pattern), []byte(str)) // Same as Match to avoid convertion (bad example here)\n    resultMBR = wildcard.MatchByRune(pattern, str) // Slower than Match but with strict rune comparison (not grapheme cluster)\n\n\tfmt.Println(str, pattern, result)\n}\n```\n\n## 🛸 Benchmark\nThe benchmark is done with the following command:\n```bash\ngo test -benchmem -bench . github.com/IGLOU-EU/go-wildcard/v2/benchmark\n```\n\n```yml\ngoos: linux\ngoarch: amd64\npkg: github.com/IGLOU-EU/go-wildcard/v2\ncpu: AMD Ryzen 7 PRO 6850U with Radeon Graphics  \n```\n\nThe tested fonctions are:\n- regexp.MatchString\n- filepath.Match\n- oldMatchSimple `From the commit a899be92514ed08aa5271bc3b93320b719ce2114`\n- oldMatch `From the commit a899be92514ed08aa5271bc3b93320b719ce2114`\n- Match `From string with byte comparison`\n- MatchByRune `From string with rune comparison`\n- MatchFromByte `From byte slice with byte comparison`\n\n![time bench](./assets/graph_time.png)\n![allocs bench](./assets/graph_allocs.png)\n\n## 🕰 History \nOriginally, this library was a fork from the Minio project.\nThe purpose was to give access to this \"lib\" under Apache license, without importing the entire Minio project.\nAnd to keep it usable under the Apache License Version 2.0 after MinIO project is migrated to GNU Affero General Public License 3.0 or later from [`update license change for MinIO`](https://github.com/minio/minio/commit/069432566fcfac1f1053677cc925ddafd750730a)\n\nThe actual Minio wildcard matching code can be found in [`wildcard.go`](https://github.com/minio/pkg/tree/main/wildcard)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIGLOU-EU%2Fgo-wildcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIGLOU-EU%2Fgo-wildcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIGLOU-EU%2Fgo-wildcard/lists"}