If I wanted to remove things like:
.!,'”^-# from an array of strings, how would I go about this while retaining all alphabetical and numeric characters.
Allowed alphabetical characters should also include letters with diacritical marks including à or ç.
You should use a regex with the correct character property. In this case, you can invert the
Alnumclass (Alphabetic and numeric character):For more complex cases, say you wanted also punctuation, you can also build a set of acceptable characters like:
For all character properties, you can refer to the doc.