$ npm install newline-regex
Regex for newline characters
npm install --save newline-regex
var newlineRegex = require('newline-regex');
newlineRegex.test('Unix\n');
// => true
newlineRegex.test('Windows\r\n');
// => true
newlineRegex.test('Nothing');
// => false
// newlineRegex.g is the regex with a global identifier
'Unix\n and Windows\r\n'.match(newlineRegex.g).length;
// => 2
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE