# str-match

> String matcher that output the input string replacing the match.

Latest version **2.1.7** (published 2020-06-01) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.7 |
| Published | 2020-06-01 |
| First published | 2016-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6 |
| Dependencies | 1 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kiko Beats |
| Maintainers | kikobeats |
| Keywords | all, global, many, match, matches, modify, multiple, needle, replace, replacement, replacer, search, str, string, sub-string, substring, text |

## Links

- npm: https://www.npmjs.com/package/str-match
- Repository: https://github.com/kikobeats/str-match
- Homepage: https://github.com/Kikobeats/str-match
- Issues: https://github.com/Kikobeats/str-match/issues
- npm.io page: https://npm.io/package/str-match

## Dependencies (1)

- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ~4.0.0

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 2.1.7 (latest) — 2020-06-01
- 2.1.6 — 2020-06-01
- 2.1.5 — 2020-04-23
- 2.1.4 — 2020-04-08
- 2.1.3 — 2019-04-17
- 2.1.2 — 2017-07-01
- 2.1.1 — 2017-01-06
- 2.1.0 — 2016-12-16
- 2.0.0 — 2016-11-14
- 1.0.0 — 2016-11-06

## README

# str-match

![Last version](https://img.shields.io/github/tag/Kikobeats/str-match.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/Kikobeats/str-match/master.svg?style=flat-square)](https://travis-ci.org/Kikobeats/str-match)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/str-match.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/str-match)
[![Dependency status](https://img.shields.io/david/Kikobeats/str-match.svg?style=flat-square)](https://david-dm.org/Kikobeats/str-match)
[![Dev Dependencies Status](https://img.shields.io/david/dev/Kikobeats/str-match.svg?style=flat-square)](https://david-dm.org/Kikobeats/str-match#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/str-match.svg?style=flat-square)](https://www.npmjs.org/package/str-match)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/Kikobeats)

> String matcher that output the input string replacing the match.

I created this module for be easy create a pipeline string processor, where the output of a pipe is the input of the next pipe.

## Install

```bash
$ npm install str-match --save
```

## Usage

```js
const strmatch = require('str-match')({ replacement: 'gift' })

const str = "I'm selling my Macbook Pro"
const regex = /selling/i
const detection = strmatch(str, regex)

console.log(detection)
// {
//  test: true,
//  match: 'Macbook Pro',
//  input: 'I\'m selling my Macbook Pro',
//  output: 'I\'m gift my Macbook Pro'
//  }
```

## API

### .constructor([opts])

#### opts

##### opts.flags

Type: `string`<br>
Default: `''`

##### opts.replacement

Type: `string`<br>
Default: `''`

### strmatch(str, regex)

#### str

*Required*<br>
Type: `string`

#### regex

*Required*<br>
Type: `regexp`

## License

MIT © [Kiko Beats](https://github.com/Kikobeats).

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