Looks like the fastest way (because Regex is really slow) to test for a number is Math.floor(string) (http://jsperf.com/performance-of-parseint). It'll return NaN if isn't, which you can check for by isNan()