# regex-occurrence

> Get the number of occurrences of a RegExp in a string

Latest version **1.0.0** (published 2015-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install regex-occurrence
pnpm add regex-occurrence
yarn add regex-occurrence
bun add regex-occurrence
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-12-21 |
| First published | 2015-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Sam Verschueren |
| Maintainers | samverschueren |
| Keywords | regex, regexp, occurrence, occurrences, count, needle, haystack, search |

## Links

- npm: https://www.npmjs.com/package/regex-occurrence
- Repository: https://github.com/samverschueren/regex-occurrence
- Homepage: https://github.com/samverschueren/regex-occurrence#readme
- Issues: https://github.com/samverschueren/regex-occurrence/issues
- npm.io page: https://npm.io/package/regex-occurrence

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-12-21

## README

# regex-occurrence [![Build Status](https://travis-ci.org/SamVerschueren/regex-occurrence.svg?branch=master)](https://travis-ci.org/SamVerschueren/regex-occurrence)

> Get the number of occurrences of a RegExp in a string


## Install

```
$ npm install --save regex-occurrence
```


## Usage

```js
const regexOccurrence = require('regex-occurrence');

regexOccurrence('foo bar', /F/);
//=> 0

regexOccurrence('foo bar', /Foo/i);
//=> 1

regexOccurrence('foo bar\nfoo baz', [/foo/, /baz/]);
//=> 2

regexOccurrence('foo bar\nfoo baz', [/foo/g, /baz/]);
//=> 3
```


## API

### regexOccurrence(input, search)

#### input

Type: `string`

The string to search in.

#### search

Type: `RegExp`, `RegExp[]`

The regular expressions to search for.


## License

MIT © [Sam Verschueren](http://github.com/SamVerschueren)

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