https://github.com/jonschlinkert/line-number
Get the line number for each regex match found in a string.
https://github.com/jonschlinkert/line-number
index javascript jonschlinkert line match matches number regex regex-match regular-expression split string util
Last synced: about 2 months ago
JSON representation
Get the line number for each regex match found in a string.
- Host: GitHub
- URL: https://github.com/jonschlinkert/line-number
- Owner: jonschlinkert
- License: mit
- Created: 2014-07-02T07:33:41.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T10:10:59.000Z (about 6 years ago)
- Last Synced: 2025-03-31T05:03:24.540Z (3 months ago)
- Topics: index, javascript, jonschlinkert, line, match, matches, number, regex, regex-match, regular-expression, split, string, util
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 5.86 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# line-number [](http://badge.fury.io/js/line-number)
> Get the line number for each regex match found in a string.
## Install
Install with [npm](npmjs.org):```bash
npm i line-number --save-dev
```## Usage
```js
var lineNumber = require('line-number');
var fixture = fs.readFileSync('LICENSE-MIT', 'utf8');
var re = /Jon[^,]+/g;
console.log(lineNumber(fixture, re));
//=> results in:
// [
// {
// "line": "Copyright (c) 2014 Jon Schlinkert, contributors.",
// "number": 1,
// "match": "Jon Schlinkert"
// }
// ];
```## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 02, 2014._