filterCharacters function

Filter characters