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 custom software to possibly affect the actual Max OSX portability of this script. Try it out!