Last active
August 29, 2015 14:14
-
-
Save Alex1990/1dc0178b355ccea04bca to your computer and use it in GitHub Desktop.
Decimal number regular expression.
This file contains hidden or 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
| /** | |
| * Decimal number regular expression. | |
| * | |
| * Valid decimal strings: | |
| * ['1', '1.', '1.1', '.1', '+1', '+1.', '+1.1', '+.1', '-1', '-1.', '-1.1', '-.1'] | |
| * Invalid decimal strings: | |
| * ['', '.', '+.', '-.', '1.1.', '1..1', 'Infinity', '-Infinity'] | |
| * | |
| * Ref: | |
| * http://stackoverflow.com/questions/12117024/decimal-number-regular-expression | |
| */ | |
| var rDecimal = /^[+-]?(?:\d+\.?\d*|\.\d+)$/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment