regex-matches
v1.0.1
Published
Get regex matches without looping
Downloads
97
Readme
regex-matches
Get regex matches without looping
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