[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

arthurvr/percentage-regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

percentage-regex Build Status

Regular expression to match percentage values

Install

$ npm install --save percentage-regex

Usage

const percentageRegex = require('percentage-regex');

'I am 99% sure that was a unicorn'.match(percentageRegex());
//=> ['99%']

'I had 83% for maths and 68% for French'.match(percentageRegex());
//=> ['83%', '68%']

percentageRegex({exact: true}).test('88%');
//=> true

API

percentageRegex(options)

Returns a regex for matching percentage values.

options.exact

Type: boolean
Default: false

Only match an exact string. Useful with RegExp#test to check if some string is a percentage.

License

MIT © Arthur Verschaeve

About

Regex to match a percentage value

Resources

License

Stars

Watchers

Forks

Packages

No packages published