replace tag to space, and remove trim trailing space