{"id":13656552,"url":"https://github.com/terkelg/globrex","last_synced_at":"2025-10-04T13:50:50.909Z","repository":{"id":41258144,"uuid":"128882238","full_name":"terkelg/globrex","owner":"terkelg","description":"Glob to regular expression with support for extended globs.","archived":false,"fork":false,"pushed_at":"2024-09-06T22:15:05.000Z","size":88,"stargazers_count":72,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T04:03:04.439Z","etag":null,"topics":["glob","glob-to-regex","globbing","pattern","regex","regexp","regular-expression","wildcard"],"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/terkelg.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":"2018-04-10T06:08:55.000Z","updated_at":"2025-02-23T08:45:24.000Z","dependencies_parsed_at":"2024-09-07T01:21:25.312Z","dependency_job_id":"e164962d-668d-4353-8032-b81335f9dddb","html_url":"https://github.com/terkelg/globrex","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.06896551724137934,"last_synced_commit":"7fa4690cd569d1b91e5f017208ba2b7cc2eca83e"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fglobrex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fglobrex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fglobrex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fglobrex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terkelg","download_url":"https://codeload.github.com/terkelg/globrex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"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","glob-to-regex","globbing","pattern","regex","regexp","regular-expression","wildcard"],"created_at":"2024-08-02T05:00:23.333Z","updated_at":"2025-10-04T13:50:45.890Z","avatar_url":"https://github.com/terkelg.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/terkelg/globrex/raw/master/globrex.png\" alt=\"globrex\" width=\"500\" /\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eglobrex\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/globrex\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/globrex.svg\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/terkelg/globrex\"\u003e\n    \u003cimg src=\"https://img.shields.io/travis/terkelg/globrex.svg\" alt=\"travis\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://ci.appveyor.com/project/terkelg/globrex\"\u003e\n    \u003cimg src=\"https://ci.appveyor.com/api/projects/status/ecbnb3whibj5iqcj?svg=true\" alt=\"appveyor\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/globrex\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/globrex.svg\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003eSimple but powerful glob to regular expression compiler.\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\n## Install\n\n```\nnpm install globrex --save\n```\n\n\n## Core Features\n\n- 💪 **extended globbing:** transform advance `ExtGlob` features\n- 📦 **simple**: no dependencies\n- 🛣️ **paths**: split paths into multiple `RegExp` segments\n\n\n## Usage\n\n```js\nconst globrex = require('globrex');\n\nconst result = globrex('p*uck')\n// =\u003e { regex: /^p.*uck$/, string: '^p.*uck$', segments: [ /^p.*uck$/ ] }\n\nresult.regex.test('pluck'); // true\n```\n\n\n## API\n\n### globrex(glob, options)\n\nType: `function`\u003cbr\u003e\nReturns: `Object`\n\nTransform globs into regular expressions.\nReturns object with the following properties:\n\n\n#### regex\n\nType: `RegExp`\n\nJavaScript `RegExp` instance.\n\n\u003e **Note**: Read more about how to use [RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) on MDN.\n\n\n#### path\n\nThis property only exists if the option `filepath` is true.\n\n\u003e **Note:** `filepath` is `false` by default\n\n#### path.segments\n\nType: `Array`\n\nArray of `RegExp` instances seperated by `/`. \nThis can be usable when working with file paths or urls. \n\nExample array could be:\n```js\n[ /^foo$/, /^bar$/, /^([^\\/]*)$/, '^baz\\\\.(md|js|txt)$' ]\n```\n\n\n#### path.regex\n\nType: `RegExp`\n\nJavaScript `RegExp` instance build for testign against paths.\nThe regex have different path seperators depending on host OS.\n\n\n### glob\n\nType: `String`\n\nGlob string to transform.\n\n\n### options.extended\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nEnable all advanced features from `extglob`.\n\nMatching so called \"extended\" globs pattern like single character matching, matching ranges of characters, group matching, etc.\n\n\u003e **Note**: Interprets `[a-d]` as `[abcd]`. To match a literal `-`, include it as first or last character.\n\n\n### options.globstar\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nWhen globstar is `false` globs like `'/foo/*'` are transformed to the following\n`'^\\/foo\\/.*$'` which will match any string beginning with `'/foo/'`.\n\nWhen the globstar option is `true`, the same `'/foo/*'` glob is transformed to\n`'^\\/foo\\/[^/]*$'` which will match any string beginning with `'/foo/'` that **does not have** a `'/'` to the right of it. `'/foo/*'` will match: `'/foo/bar'`, `'/foo/bar.txt'` but not `'/foo/bar/baz'` or `'/foo/bar/baz.txt'`.\n\n\u003e **Note**: When globstar is `true`, `'/foo/**'` is equivelant to `'/foo/*'` when globstar is `false`.\n\n\n### options.strict\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nBe forgiving about mutiple slashes, like `///` and make everything after the first `/` optional. This is how bash glob works.\n\n\n### options.flags\n\nType: `String`\u003cbr\u003e\nDefault: `''`\n\nRegExp flags (e.g. `'i'` ) to pass to the RegExp constructor.\n\n\n### options.filepath\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nParse input strings as it was a file path for special path related features. This feature only makes sense if the input is a POSIX path like `/foo/bar/hello.js` or URLs.\n\nWhen `true` the returned object will have an additional `path` object.\n\n- `segment`: Array containing a `RegExp` object for each path segment.\n- `regex`: OS specific file path `RegExp`. Path seperator used is based on the operating system.\n- `globstar`: Regex string used to test for globstars.\n\n\u003e **Note: Please only use forward-slashes in file path glob expressions**\n\u003e Though windows uses either `/` or `\\` as its path separator, only `/`\n\u003e characters are used by this glob implementation.  You must use\n\u003e forward-slashes **only** in glob expressions. Back-slashes will always\n\u003e be interpreted as escape characters, not path separators.\n\n\n## References\n\nLearn more about advanced globbing here\n- [mywiki.wooledge.org/glob](http://mywiki.wooledge.org/glob)\n- [linuxjournal](http://www.linuxjournal.com/content/bash-extended-globbing)\n\n\n## License\n\nMIT © [Terkel Gjervig](https://terkel.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fglobrex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterkelg%2Fglobrex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fglobrex/lists"}