unfortunately the `sed` available on osx doesn't handle `-r`, so we need to finde a cross-platform regex or use perl.