Replace special characters form a String Variable

Hi, I need to replace or delete all the special characters from a string variable.
I was trying to use the .Replace method but it only replaces 1 character, I want it to replace as many special characters the variable has.
Is that possible?
in the image is an example of the variable but it could have any other special characters as: :/?*
And I want the variable to be “MISC OTHER” or “MISCOTHER”.
image

Hi @Allison_Cruz

Kindly try this
System.Text.RegularExpressions.Regex.Replace(variable, “[^a-z A-Z 0-9]”, “”)

Thanks

Variable there stands for your variable name

Hi,

FYI, another solution:

System.Text.RegularExpressions.Regex.Replace(yourString,"\W","")

OR

System.Text.RegularExpressions.Regex.Replace(yourString,"\W+"," ")

Regards,

Kindly check @Allison_Cruz

And let us know if this work for you

Thanks