sindresorhus/is-regexp

Check if a value is a regular expression

JavaScript

26

16 commits

updated Sep 18, 2026

See the code

README

is-regexp

Check if a value is a regular expression

Install

$ npm install is-regexp

Usage

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?

  • is - Type check values

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

sindresorhus/is-regexp

Check if a value is a regular expression

JavaScript

26

16 commits

updated Sep 18, 2026

See the code

README

is-regexp

Check if a value is a regular expression

Install

$ npm install is-regexp

Usage

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?

  • is - Type check values

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Project health

Overall

3.5/10

Maintained

0/10

Code review

1/10
OpenSSF Scorecard

Latest release

3.1.0 · Oct 31, 2021

Releases this year

0