Skip to content

ecrmnn/regex-matches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published