Created
September 26, 2019 16:40
-
-
Save MarkMYoung/8b836302af671b17a4c51a5d3e865685 to your computer and use it in GitHub Desktop.
Regular Expression Toolbox: Monetary Number Pattern (Up to 2 Decimal Places)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// | |
let RegExpToolbox = | |
{ | |
// This regular expression which matches only numbers with up to two decimal | |
// places, and allowing a preceding decimal (without a zero) | |
// but not a trailing decimal. | |
monetaryNumberRegExp:new RegExp( "^(\\d+(?:[\\.]\\d{1,2})?|(?:\\d+)?(?:[\\.]\\d{1,2}))$" ), | |
} | |
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment