npm.io
1.0.0 • Published 3d ago

regexp-is-capturing

Licence
MIT
Version
1.0.0
Deps
1
Size
3 kB
Vulns
0
Weekly
0

RegExp Is Capturing

A function that tells you whether a RegExp contains capturing groups or not.

All features up to ES2025 are supported.

Install

npm install regexp-is-capturing

Usage

import isCapturing from 'regexp-is-capturing';

// Let's check if some regexes contain capturing groups or not

isCapturing ( /foo/ ); // => false
isCapturing ( /(foo)/ ); // => true
isCapturing ( /(?<foo>bar)/ ); // => true
isCapturing ( /(?:foo)/ ); // => false

License

MIT Fabio Spampinato

Keywords