Neologistic Paraphasic Mumbling
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@vipulc/line-match

1.0.3 • Public • Published

line-match

npm (scoped) npm GitHub issues GitHub forks GitHub stars GitHub license

Returns lines matching a pattern in a string. Supports inverse operation as well, to exclude lines with matches.

Install

$ npm install @vipulc/line-match

Usage

multiLineString.lineMatch(pattern);

Example

require("@vipulc/line-match");
 
const str1 = `Brave New World
  Fear and Loathing in Las Vegas
  World War Z`;
 
// lines ending with 'World'
console.log(str1.lineMatch(/World$/));
//=> ['Brave New World']
 
const str2 = `Brave New World
  Fear and Loathing in Las Vegas
  World War Z`;
 
// exclude lines ending with 'World'
console.log(str2.lineMatch(/World$/, { inverse: true }));
//=> [ '  Fear and Loathing in Las Vegas', '  World War Z' ]

License

MIT License


Install

npm i @vipulc/line-match

DownloadsWeekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

6.43 kB

Total Files

6

Last publish

Collaborators

  • avatar