# recursive-match

> Recursively match input string with begin and end delimiters

Latest version **1.0.2** (published 2022-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install recursive-match
pnpm add recursive-match
yarn add recursive-match
bun add recursive-match
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-03-12 |
| First published | 2021-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Aswin Kumar |
| Maintainers | aswinkumar863 |
| Keywords | recursive, match, regex, strings, nested |

## Links

- npm: https://www.npmjs.com/package/recursive-match
- Repository: https://github.com/aswinkumar863/recursive-match
- Homepage: https://github.com/aswinkumar863/recursive-match#readme
- Issues: https://github.com/aswinkumar863/recursive-match/issues
- Funding: https://paypal.me/aswinkumar863
- npm.io page: https://npm.io/package/recursive-match

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-03-12
- 1.0.1 — 2021-09-13

## README

# Recursive Match

Recursively match input string with begin and end delimiters.

![build status](https://img.shields.io/travis/aswinkumar863/recursive-match)
![npm](https://img.shields.io/npm/v/recursive-match)
![dependencies](https://img.shields.io/librariesio/release/npm/recursive-match)
![downloads](https://img.shields.io/npm/dw/recursive-match)
![license](https://img.shields.io/npm/l/recursive-match)

## Highlights

- Builds with typescript.
- No dependencies.
- Supports both string and regex delimiters.
- Supports nested matches.

**Note:** May not be suitable for handling identical delimiters.

## Installation

Using [npm](https://npmjs.org):

```bash
npm install recursive-match
```

## Usage

```js
import { recursiveMatch } from 'recursive-match'

recursiveMatch('a{b{c}d}e', '{', '}')
/* [{"start":1,"end":8,"bodyStart":2,"bodyEnd":7,"match":"{b{c}d}",
"children":[{"start":3,"end":6,"bodyStart":4,"bodyEnd":5,"match":"{c}","children":[]}]}] */

recursiveMatch('abc{{{de}}}fgh', /{+/, /}+/)
/* [{"start":3,"end":11,"bodyStart":6,"bodyEnd":8,"match":"{{{de}}}","children":[]}] */
```
## API

### `recursiveMatch(string, begin, end)`

- **string**  `{string}` - The input string to match recursively.
- **begin** `{string|RegExp}` - The begin delimiter.
- **end** `{string|RegExp}` - The end delimiter.

## Credits

recursive-match is heavily inspired by the [jbnicolai/match-recursive](https://github.com/jbnicolai/match-recursive). Ultimately recursive-match is an effort to provide usable information like start and end index about the match.

## License

recursive-match is licensed under a [MIT License](https://github.com/aswinkumar863/recursive-match/blob/main/LICENSE).

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