{"_id":"string-search","_rev":"197697","name":"string-search","description":"Node module for searching multi-line string using regex","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"ospatil","email":"ospatil@gmail.com"}],"time":{"modified":"2023-03-20T08:08:05.000Z","created":"2015-11-06T21:41:02.911Z","1.2.0":"2015-11-09T00:52:55.206Z","1.1.0":"2015-11-08T17:16:28.054Z","1.0.0":"2015-11-06T21:41:02.911Z"},"users":{},"author":{"name":"Omkar Patil","email":"ospatil@gmail.com","url":"https://github.com/ospatil"},"repository":{"type":"git","url":"git+https://github.com/ospatil/string-search.git"},"versions":{"1.2.0":{"name":"string-search","version":"1.2.0","description":"Node module for searching multi-line string using regex","homepage":"https://github.com/ospatil/string-search","author":{"name":"Omkar Patil","email":"ospatil@gmail.com","url":"https://github.com/ospatil"},"files":["dist"],"main":"dist/index.js","keywords":["search","text search","regex","node"],"repository":{"type":"git","url":"git+https://github.com/ospatil/string-search.git"},"devDependencies":{"babel-core":"^5.5.0","chai":"3.4.0","chai-as-promised":"5.1.0","del":"^2.0.2","gulp":"^3.6.0","gulp-babel":"^5.1.0","gulp-coveralls":"^0.1.0","gulp-eslint":"^1.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","isparta":"^3.0.3"},"scripts":{"prepublish":"gulp prepublish","test":"gulp"},"license":"MIT","dependencies":{"bluebird":"3.0.5"},"gitHead":"bf7e535691bf303c0bcb49895a1ac68e20987656","bugs":{"url":"https://github.com/ospatil/string-search/issues"},"_id":"string-search@1.2.0","_shasum":"b42d1b9496d24853d263b39d37fae8f7c3be9278","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"ospatil","email":"ospatil@gmail.com"},"dist":{"shasum":"b42d1b9496d24853d263b39d37fae8f7c3be9278","size":2794,"noattachment":false,"key":"/string-search/-/string-search-1.2.0.tgz","tarball":"http://name.csiicloud.com:7001/string-search/download/string-search-1.2.0.tgz"},"maintainers":[{"name":"ospatil","email":"ospatil@gmail.com"}],"directories":{},"publish_time":1447030375206,"_hasShrinkwrap":false,"_cnpm_publish_time":1447030375206,"_cnpmcore_publish_time":"2021-12-18T20:26:13.932Z"},"1.1.0":{"name":"string-search","version":"1.1.0","description":"Node module for searching multi-line string using regex","homepage":"https://github.com/ospatil/string-search","author":{"name":"Omkar Patil","email":"ospatil@gmail.com","url":"https://github.com/ospatil"},"files":["dist"],"main":"dist/index.js","keywords":["search","text search","regex","node"],"repository":{"type":"git","url":"git+https://github.com/ospatil/string-search.git"},"devDependencies":{"babel-core":"^5.5.0","chai":"3.4.0","chai-as-promised":"5.1.0","del":"^2.0.2","gulp":"^3.6.0","gulp-babel":"^5.1.0","gulp-coveralls":"^0.1.0","gulp-eslint":"^1.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","isparta":"^3.0.3"},"scripts":{"prepublish":"gulp prepublish","test":"gulp"},"license":"MIT","dependencies":{"bluebird":"3.0.5"},"gitHead":"b9c74cbc581c09f4a2b3ac4395a6601ce261d5ef","bugs":{"url":"https://github.com/ospatil/string-search/issues"},"_id":"string-search@1.1.0","_shasum":"4baeb7c0b8780f3f5a3f785cf6f03e97120c6c03","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"ospatil","email":"ospatil@gmail.com"},"dist":{"shasum":"4baeb7c0b8780f3f5a3f785cf6f03e97120c6c03","size":2776,"noattachment":false,"key":"/string-search/-/string-search-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/string-search/download/string-search-1.1.0.tgz"},"maintainers":[{"name":"ospatil","email":"ospatil@gmail.com"}],"directories":{},"publish_time":1447002988054,"_hasShrinkwrap":false,"_cnpm_publish_time":1447002988054,"_cnpmcore_publish_time":"2021-12-18T20:26:14.124Z"},"1.0.0":{"name":"string-search","version":"1.0.0","description":"Node module for searching multi-line string using regex","homepage":"https://github.com/ospatil/string-search","author":{"name":"Patil, Omkar","email":"ospatil@gmail.com","url":"https://github.com/ospatil"},"files":["dist"],"main":"dist/index.js","keywords":["search","text","search","regex","node"],"repository":{"type":"git","url":"git+https://github.com/ospatil/string-search.git"},"devDependencies":{"babel-core":"^5.5.0","chai":"3.4.0","chai-as-promised":"5.1.0","del":"^2.0.2","gulp":"^3.6.0","gulp-babel":"^5.1.0","gulp-coveralls":"^0.1.0","gulp-eslint":"^1.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","isparta":"^3.0.3"},"scripts":{"prepublish":"gulp prepublish","test":"gulp"},"license":"MIT","dependencies":{"bluebird":"3.0.5"},"gitHead":"5ba5334c164cf8e300182182a9a81462fdd06452","bugs":{"url":"https://github.com/ospatil/string-search/issues"},"_id":"string-search@1.0.0","_shasum":"47e3e2315c08066e0dafcc9054ba296d2e265a92","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"ospatil","email":"ospatil@gmail.com"},"dist":{"shasum":"47e3e2315c08066e0dafcc9054ba296d2e265a92","size":2767,"noattachment":false,"key":"/string-search/-/string-search-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/string-search/download/string-search-1.0.0.tgz"},"maintainers":[{"name":"ospatil","email":"ospatil@gmail.com"}],"directories":{},"publish_time":1446846062911,"_hasShrinkwrap":false,"_cnpm_publish_time":1446846062911,"_cnpmcore_publish_time":"2021-12-18T20:26:14.357Z"}},"readme":"# string-search \n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url]\n> Node module that carries out regex search on given multi-line string and returns match information.\n\n## Features\n[string-search](https://github.com/ospatil/string-search) finds and returns match information for each match.\n- Accepts a multi-line string and regular expression in string format. \n- Searches the given string with provided regular expression.\n- Returns a promise that eventually resolves to an array. The array contains match objects each having following attributes - \n  - line - line number(s) that the matched result was found on.\n  - term - the search term.\n  - text - the entire line(s) that the matched result was found in.\n\n## Getting Started\nInstall with [NPM](https://www.npmjs.com) - `npm install --save string-search`\n\n## Usage\n```js\nvar stringSearcher = require('string-search');\n\nstringSearcher.find('This is the string to search text in', 'string')\n  .then(function(resultArr) {\n    //resultArr => [ {line: 1, text: 'This is the string to search text in'} ]\n  });\n```\n\n## API\n### stringSearcher.find(targetString, regex)\n\nName         | Type           | Argument     | Description\n-------------|----------------|--------------|------------\ntargetString | `string`       | `<required>` | target string to be searched. Can be multi-line(can contain line breaks).\nregex        | `string`       | `<required>` | a string in regular expression format to search.\n\nReturns **promise** that resolves to an array of objects containing following attributes -\n\nName | Type      | Description\n-----|-----------| ------------\nline | `integer` | line number that the matched result was found on.\nterm | `string`  | The search term\ntext | `string`  | the entire line(s) that the matched result was found in.\n\n## Contributing\nIn lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.\n\n## Notes\nHeavily inspired by [lineder](https://github.com/jasonbellamy/lineder). I needed file reading part separated from text searching part \nso that a file can be read only once and multiple searches can be carried out on it. I also used promise to return results instead of a callback.\n\n## License\nCopyright © 2015 [Omkar Patil](https://github.com/ospatil)\n\nLicensed under the MIT license.\n\n[npm-image]: https://badge.fury.io/js/string-search.svg?style=flat-square\n[npm-url]: https://npmjs.org/string-search\n[travis-image]: https://travis-ci.org/ospatil/string-search.svg?branch=master&style=flat-square\n[travis-url]: https://travis-ci.org/ospatil/string-search\n[daviddm-image]: https://david-dm.org/ospatil/string-search.svg?theme=shields.io&style=flat-square\n[daviddm-url]: https://david-dm.org/ospatil/string-search\n[coveralls-image]: https://img.shields.io/coveralls/ospatil/string-search.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/github/ospatil/string-search?branch=master\n","_attachments":{},"homepage":"https://github.com/ospatil/string-search","bugs":{"url":"https://github.com/ospatil/string-search/issues"},"license":"MIT"}