regex-matches

1.0.1 • Public • Published

regex-matches

Get regex matches without looping

travis npm version npm downloads npm license prs Welcome eslint

Installation

npm install regex-matches --save

Usage

const re = require('regex-matches')
 
re(/\b\w*[Oo]\w*\b/, 'the quick brown fox jumps over the lazy dog');
 
//=> [
//=>   ['brown'],
//=>   ['fox'],
//=>   ['over'],
//=>   ['dog']
//=> ]
 
// Result when using capture groups
re(/\b\w*([Oo])\w*\b/, 'the quick brown fox jumps over the lazy dog');
 
//=> [
//=>   ['brown', 'o],
//=>   ['fox', 'o],
//=>   ['over', 'o],
//=>   ['dog', 'o]
//=> ]

License

MIT © Daniel Eckermann

Readme

Keywords

none

Package Sidebar

Install

npm i regex-matches

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ecrmnn