Iproved regex in cmake script for os x support