Fixes sed regular expression flag differences, plus expr number parsing problems by removing whitespace
Check if sed accepts the -r flag, otherwise try -E
Merge branch 'mac-osx-fixes-sed-expr'