remove leading and trailing dashes and underscores from token strings