sanitize input query to remove possible space characters