use keeppatterns in remove_trailing_space