1.0.1 • Published 6 years ago

regex-matches v1.0.1

Weekly downloads
29
License
MIT
Repository
github
Last release
6 years ago

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