# is-regexp

> Check if a value is a regular expression

Latest version **3.1.0** (published 2021-10-31) · MIT license · 0 weekly downloads

> **Better alternative:** Use v instanceof RegExp, or if cross-realm, use Object.prototype.toString.call(v) === "[object RegExp]" — Consider using a lighter alternative

## Install

```sh
npm install is-regexp
pnpm add is-regexp
yarn add is-regexp
bun add is-regexp
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2021-10-31 |
| First published | 2014-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | regex, regexp, regular, expression, regular expression, check, type, is |

## Links

- npm: https://www.npmjs.com/package/is-regexp
- Repository: https://github.com/sindresorhus/is-regexp
- Homepage: https://github.com/sindresorhus/is-regexp#readme
- Issues: https://github.com/sindresorhus/is-regexp/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-regexp

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2021-10-31
- 3.0.0 — 2021-04-07
- 2.1.0 — 2019-04-16
- 2.0.0 — 2018-03-22
- 1.0.0 — 2014-06-11

## README

# is-regexp

> Check if a value is a regular expression

## Install

```
$ npm install is-regexp
```

## Usage

```js
import isRegexp from 'is-regexp';

isRegexp('unicorn');
//=> false

isRegexp(/unicorn/);
//=> true

isRegexp(new RegExp('unicorn'));
//=> true
```

## FAQ

#### [Why not just use `instanceof` instead of this package?](https://github.com/sindresorhus/is#why-not-just-use-instanceof-instead-of-this-package)

## Related

- [is](https://github.com/sindresorhus/is) - Type check values

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-is-regexp?utm_source=npm-is-regexp&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

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