{"id":15343700,"url":"https://github.com/spacewander/little-lua-glob","last_synced_at":"2025-06-14T19:32:23.661Z","repository":{"id":71091863,"uuid":"263898857","full_name":"spacewander/little-lua-glob","owner":"spacewander","description":"A little implementation of glob in Lua","archived":false,"fork":false,"pushed_at":"2020-11-12T03:15:50.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-19T00:38:32.555Z","etag":null,"topics":["glob","wildcard"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spacewander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-05-14T11:41:28.000Z","updated_at":"2020-11-12T03:15:52.000Z","dependencies_parsed_at":"2023-03-06T01:30:36.849Z","dependency_job_id":null,"html_url":"https://github.com/spacewander/little-lua-glob","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.25,"last_synced_commit":"0be7b1ae06799b94145214b37a9e7019f8e16e7c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spacewander/little-lua-glob","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flittle-lua-glob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flittle-lua-glob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flittle-lua-glob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flittle-lua-glob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacewander","download_url":"https://codeload.github.com/spacewander/little-lua-glob/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flittle-lua-glob/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259870744,"owners_count":22924586,"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":["glob","wildcard"],"created_at":"2024-10-01T10:49:02.186Z","updated_at":"2025-06-14T19:32:23.592Z","avatar_url":"https://github.com/spacewander.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# little-lua-glob\n\nA little implementation of glob in Lua.\n\nThis library is ported from https://github.com/ryanuber/go-glob.\nUnlike other implementations which support all kinds of wildcard, this library only supports '\\*'.\nHowever, supporting '\\*' is enough for most of cases while keeping the implementation simple.\n\nCompared with other implementations, this library has several advantages:\n* simple: you can put the single Lua file in your project directly.\n* safe: it doesn't use backtrack to match the (possibly evil) user input, see [security](#security) section for the details.\n\nAs for the performance, this library is almost as fast as a PCRE regex base implementation. See the ./benchmark.lua for the details.\n\n## Usage\n\n```lua\nlocal glob = require \"glob\"\nlocal pat = \"a.*b.com\"\nlocal matcher = glob.compile(pat)\nprint(matcher:match(\"a.aliyun.b.com\"))\n```\n\n## Security\n\nLike regex, if the greedy pattern is (incorrecly) used in the glob implementation, an evil user input may cause terrible performance problem. For example:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/gobwas/glob\"\n)\n\nfunc main() {\n\ts := strings.Repeat(\"12345\", 25)\n\tpat := strings.Repeat(\"*5\", 25)\n\n\tstart = time.Now()\n\tvar g glob.Glob\n\tg = glob.MustCompile(pat)\n\trb := g.Match(s)\n\tfmt.Printf(\"%+v %v\\n\", time.Now().Sub(start), rb)\n}\n```\n\nIn the `./benchmark.lua`, if I use `.*` instead of `.*?` in the regex base implementation, there will have the same problem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Flittle-lua-glob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacewander%2Flittle-lua-glob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Flittle-lua-glob/lists"}