# disable-regexp-capture

> convert group to non-capturing-group: `(.+)` -> `(?:.+)`

Latest version **0.0.5** (published 2017-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install disable-regexp-capture
pnpm add disable-regexp-capture
yarn add disable-regexp-capture
bun add disable-regexp-capture
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2017-08-05 |
| First published | 2017-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sho Hashimoto |
| Maintainers | shokai |
| Keywords | RegExp, group, parentheses, capture |

## Links

- npm: https://www.npmjs.com/package/disable-regexp-capture
- Repository: https://github.com/shokai/disable-regexp-capture
- Homepage: https://github.com/shokai/disable-regexp-capture#readme
- Issues: https://github.com/shokai/disable-regexp-capture/issues
- npm.io page: https://npm.io/package/disable-regexp-capture

## Recent versions

- 0.0.5 (latest) — 2017-08-05
- 0.0.4 — 2017-07-11
- 0.0.3 — 2017-07-11
- 0.0.2 — 2017-07-11
- 0.0.1 — 2017-07-10

## README

# disable-regexp-capture

convert group to non-capturing group `(.+)` -> `(?:.+)`

- https://npmjs.com/package/disable-regexp-capture
- https://github.com/shokai/disable-regexp-capture

[![CircleCI](https://circleci.com/gh/shokai/disable-regexp-capture.svg?style=svg)](https://circleci.com/gh/shokai/disable-regexp-capture)


## Install

    $ npm install disable-regexp-capture -save


## Usage


```js
import disableRegexpCapture from 'disable-regexp-capture'

const disabledPattern = disableRegexpCapture(/\[([^[\]]+)\]/)
console.log(disabledPattern)
// => /\[(?:[^[\]]+)\]/
```


### Behavior of `String.prototype.split` with RegExp.

without capturing-group
```js
'aaa [tag1] bbb [tag2] ccc'.split(/\[[^[\]]+\]/)
// => [ 'aaa ', ' bbb ', ' ccc' ]
```

with capturing-group
```js
'aaa [tag1] bbb [tag2] ccc'.split(/\[([^[\]]+)\]/)
// => [ 'aaa ', 'tag1', ' bbb ', 'tag2', ' ccc' ]

'aaa [tag1] bbb [tag2] ccc'.split(/(\[[^[\]]+\])/)
// => [ 'aaa ', '[tag1]', ' bbb ', '[tag2]', ' ccc' ]
```

with nested capturing-group
```js
'aaa [tag1] bbb [tag2] ccc'.split(/(\[([^[\]]+)\])/)
// => [ 'aaa ', '[tag1]', 'tag1', ' bbb ', '[tag2]', 'tag2', ' ccc' ]
```

non-capturing-group in capturing-group
```js
'aaa [tag1] bbb [tag2] ccc'.split(/(\[(?:[^[\]]+)\])/)
// => [ 'aaa ', '[tag1]', ' bbb ', '[tag2]', ' ccc' ]
```

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