agungkes / is-regexy

Easily check user input for regex patterns.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-regexy npm build codecov management: perfektđź‘Ś

A very simple library for checking if a given value (Regex object OR string) is a valid regular expression.

Useful when you want to allow users to pass regex patterns as input.

Example

const isRegexy = require('is-regexy') // CommonJS
// OR
import isRegexy from 'is-regexy' // ES modules

isRegexy('foo') // false

isRegexy(/foo/) // true
isRegexy(new RegExp('foo')) // true
isRegexy('/foo/') // true
isRegexy('/foo/ig') // true
isRegexy('/(epic|feat|fix|chore)/DEV-\\d{4}/i') //true

License

MIT

About

Easily check user input for regex patterns.

License:MIT License


Languages

Language:TypeScript 92.3%Language:JavaScript 7.7%