Created
November 22, 2008 06:20
-
-
Save kangax/27757 to your computer and use it in GitHub Desktop.
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
| var wsp = '(\\u0020|\\u0009|\\u000D|\\u000A)'; | |
| var digit = '\\d'; | |
| var digit_sequence = '(' + digit + '+' + ')'; | |
| var sign = '[-+]'; | |
| var exponent = '[eE]' + sign + '?' + digit_sequence; | |
| var fractional_constant = | |
| '(' + | |
| digit_sequence + '?' + '\\.' + digit_sequence + | |
| '|' + | |
| digit_sequence + '\\.' + | |
| ')'; | |
| var floating_point_constant = | |
| '(' + | |
| fractional_constant + exponent + '?' + | |
| '|' + | |
| digit_sequence + exponent + | |
| ')'; | |
| var integer_constant = digit_sequence; | |
| var comma = ','; | |
| var comma_wsp = | |
| '(' + | |
| '(' + wsp + '+' + comma + '?' + wsp + '*' + ')' + | |
| '|' + | |
| '(' + comma + wsp + '*' + ')' + | |
| ')'; | |
| var number = | |
| '(' + | |
| sign + '?' + integer_constant + | |
| '|' + | |
| sign + '?' + floating_point_constant + | |
| ')'; | |
| new RegExp('^'+number+'$').test('5e'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment