How to match the characters of a set