remove empty prefixes, suffixes, and group delimiters