{"id":16625482,"url":"https://github.com/aleclarson/glob-regex","last_synced_at":"2025-09-16T03:32:23.351Z","repository":{"id":60775062,"uuid":"112043673","full_name":"aleclarson/glob-regex","owner":"aleclarson","description":"Tiny glob-to-RegExp converter","archived":false,"fork":false,"pushed_at":"2018-12-15T09:43:22.000Z","size":16,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T13:46:10.723Z","etag":null,"topics":["glob","isomorphic","regexp","tiny"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/aleclarson.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}},"created_at":"2017-11-26T00:12:49.000Z","updated_at":"2024-10-22T07:37:39.000Z","dependencies_parsed_at":"2022-10-04T16:16:38.182Z","dependency_job_id":null,"html_url":"https://github.com/aleclarson/glob-regex","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fglob-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fglob-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fglob-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fglob-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleclarson","download_url":"https://codeload.github.com/aleclarson/glob-regex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233200417,"owners_count":18640370,"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","isomorphic","regexp","tiny"],"created_at":"2024-10-12T04:05:50.840Z","updated_at":"2025-09-16T03:32:17.994Z","avatar_url":"https://github.com/aleclarson.png","language":"JavaScript","funding_links":["https://paypal.me/alecdotbiz"],"categories":[],"sub_categories":[],"readme":"# glob-regex\n\n[![npm](https://img.shields.io/npm/v/glob-regex.svg)](https://www.npmjs.com/package/glob-regex)\n[![Bundle size](https://badgen.net/bundlephobia/min/glob-regex)](https://bundlephobia.com/result?p=glob-regex)\n[![Install size](https://packagephobia.now.sh/badge?p=glob-regex)](https://packagephobia.now.sh/result?p=glob-regex)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)\n\nConvert a glob to a `RegExp` object.\n\n- Any periods are escaped (`.` -\u003e `\\\\.`)\n- `*` and `**` are replaced\n- Always start with `^` and end with `$`\n- All `RegExp` syntax is valid\n- Path separators are auto-escaped by `new RegExp`\n\n```js\nconst globRegex = require('glob-regex')\n\n// Match no directory.\nlet re = globRegex('*.js')\nre.test('a.js') // =\u003e true\nre.test('a.css') // =\u003e false\nre.test('a/b.js') // =\u003e false\n\n// Use ? operator for optional character.\nre = globRegex('*.jsx?')\nre.test('a.js') // =\u003e true\nre.test('b.jsx') // =\u003e true\n\n// Match any directory.\nre = globRegex('**.css')\nre.test('a.css') // =\u003e true\nre.test('a/b.css') // =\u003e true\n\n// Match any directory and specific name.\nre = globRegex('**/a.css')\nre.test('a.css') // =\u003e true\nre.test('b/a.css') // =\u003e true\n\n// Use | operator to match multiple values.\nre = globRegex('*.(js|css)')\nre.test('a.js') // =\u003e true\nre.test('a.css') // =\u003e true\n```\n\nUse `globRegex.replace()` to transform a glob into a RegExp-compatible string.\n\n**NOTE:** It's not recommended to use `globRegex(array)` if you need\nthe `exec` method, since the result will be difficult to make use of.\nUsing the `test` method works great, though!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fglob-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleclarson%2Fglob-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fglob-regex/lists"}