FWIW a JSC Javascript variant, which should work in earlier versions of OS X, as well as in Yosemite:
(Updated to rewrite multiple numbers, preserving any separator)
(JSC is the generic Javascript engine in OSX - it doesn't do osascript automation, but the standard Javascript libraries are all there, and accessible to Execute Script actions in KM)