0.1.1 • Published 6 years ago

@regexp-extra/number v0.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

RegExp for matching number.

const NUMBER = require('@regexp-extra/number');
// -> regular expression (global)


NUMBER.test('cake');
// false

NUMBER.test('12.31');
// true

var str = '0x1 canteen: 1000kg = Infinity mangoes';
str.match(NUMBER);
// [ '0x1', '1000', 'Infinity' ]

new RegExp(NUMBER).exec(str);
// [ '0x1',
//   '',         (sign)
//   '0x1',        (mantissa)
//   undefined,  (exponent)
//   index: 0,
//   input: '0x1 canteen: 1000kg = 0x12C mangoes',
//   groups: undefined ]

NPM

credits: taken idea from substack/float-regex.

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago