Node module for searching multi-line string using regex
npm install string-searchnpm install --save string-searchjs
var stringSearcher = require('string-search');stringSearcher.find('This is the string to search text in', 'string')
.then(function(resultArr) {
//resultArr => [ {line: 1, text: 'This is the string to search text in'} ]
});
`API
$3
Name | Type | Argument | Description
-------------|----------------|--------------|------------
targetString |
string | | target string to be searched. Can be multi-line(can contain line breaks).
regex | string | | a string in regular expression format to search.Returns promise that resolves to an array of objects containing following attributes -
Name | Type | Description
-----|-----------| ------------
line |
integer | line number that the matched result was found on.
term | string | The search term
text | string` | the entire line(s) that the matched result was found in.Licensed under the MIT license.
[npm-image]: https://badge.fury.io/js/string-search.svg?style=flat-square
[npm-url]: https://npmjs.org/string-search
[travis-image]: https://travis-ci.org/ospatil/string-search.svg?branch=master&style=flat-square
[travis-url]: https://travis-ci.org/ospatil/string-search
[daviddm-image]: https://david-dm.org/ospatil/string-search.svg?theme=shields.io&style=flat-square
[daviddm-url]: https://david-dm.org/ospatil/string-search
[coveralls-image]: https://img.shields.io/coveralls/ospatil/string-search.svg?style=flat-square
[coveralls-url]: https://coveralls.io/github/ospatil/string-search?branch=master