Mac OSX fixes for `sed` extended regular expressions and and `expr` parsing numbers with whitespace

In reference to issue #1.

- The `sed` command is tested for the `-r` flag, and uses the `-E` flag as a fallback.
- Numbers from external commands are stripped from anything non-digit, before being passed into `expr`.

Tested on a non-pristine Mac OSX 10.9 Mavericks system, with enough non-system (GNU etcetera) software to possibly affect the actual Mac OSX portability of this script. Try it out!