https://github.com/lekterable/is-regexy
Easily check user input for regex patterns.
https://github.com/lekterable/is-regexy
expression is regex regex-patterns regexp regexy regular test
Last synced: 2 months ago
JSON representation
Easily check user input for regex patterns.
- Host: GitHub
- URL: https://github.com/lekterable/is-regexy
- Owner: lekterable
- License: mit
- Created: 2020-04-18T00:37:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T01:25:01.000Z (about 3 years ago)
- Last Synced: 2025-09-09T15:34:29.405Z (9 months ago)
- Topics: expression, is, regex, regex-patterns, regexp, regexy, regular, test
- Language: TypeScript
- Homepage:
- Size: 393 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# is-regexy [](https://www.npmjs.com/package/is-regexy) [](https://travis-ci.com/github/lekterable/is-regexy) [](https://codecov.io/gh/lekterable/is-regexy) [](https://github.com/lekterable/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
```js
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](LICENSE)