handle tokens with substrings