cut trailing space on regex match