get rid of all non alphanumeric characters python code example
Example 1: python string strip non alphanumeric
Regular expressions to the rescue:
import re
stripped_string = re.sub(r'\W+', '', your_string)
Example 2: How do I remove all non alphanumeric characters from a string?
Regex rgx = new Regex("[^a-zA-Z0-9 -]");
str = rgx.Replace(str, "");