# glob2regexp

> convert glob string to RegExp object

Latest version **1.0.1** (published 2019-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install glob2regexp
pnpm add glob2regexp
yarn add glob2regexp
bun add glob2regexp
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-05-16 |
| First published | 2016-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | zbinlin |
| Maintainers | zbinlin |
| Keywords | glob, regexp |

## Links

- npm: https://www.npmjs.com/package/glob2regexp
- Repository: https://github.com/zbinlin/node-glob-to-regexp
- Homepage: https://github.com/zbinlin/node-glob-to-regexp#readme
- Issues: https://github.com/zbinlin/node-glob-to-regexp/issues
- npm.io page: https://npm.io/package/glob2regexp

## Recent versions

- 1.0.1 (latest) — 2019-05-16
- 1.0.0 — 2016-06-20

## README

# glob2regexp

[![Build Status](https://img.shields.io/travis/zbinlin/node-glob-to-regexp/master.svg?style=flat-square)](https://travis-ci.org/zbinlin/node-glob-to-regexp)
[![NPM version](https://img.shields.io/npm/v/glob2regexp.svg?style=flat-square)](https://www.npmjs.org/package/glob2regexp)

> Convert glob string to RegExp object


## Usage

```javascript
var globToRegExp = require("glob2regexp");
console.log(
	globToRegExp("http?://www.example.org").test("https://www.example.org")
); // true
console.log(
	globToRegExp("http{s,}://www.example.org").test("http://www.example.org")
); // true
console.log(
	globToRegExp("http{s,}://www.example.org").test("https://www.example.org")
); // true


// match a signle character
globToRegExp("?").test("a"); // true

// match any characters
globToRegExp("*").test(""); // true, match empty character
globToRegExp("*").test("a"); // true, match a signle character
globToRegExp("*").test("aa"); // true, match multiple characters


// also supports range match
globToRegExp("[0-9]").test("0"); // true
globToRegExp("[a-z]").test("z"); // true


// and supports brace-expansion
globToRegExp("{1,2}").test("1"); // true
globToRegExp("{1,2}").test("2"); // true
globToRegExp("{1,2}").test("3"); // false
globToRegExp("{,1}").test(""); // true
globToRegExp("{,1}").test("1"); // true
```

---
_Source: https://npm.io/package/glob2regexp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
