fixed regex for osx implementation