Remove special characters from string

studio
regex

#1

Hi
I am trying to remove all possible kinds of special characters from a string.
eg. Input = "ABC-DEF@PQR"
Output = “ABC DEF PQR”

Since we don’t have .ReplaceAll function here , I’m slightly doubtful on how to proceed with it.
I tried using Matches activity with a suitable regex but I think my approach maybe wrong.

Any suggestions?


#2

You can use this regex -

System.Text.RegularExpressions.Regex.Replace(YOUR VARIABLE HERE, “[^a-z A-Z]”, “”)

it will only give you letters, in this case both capital and lowercase.


#3

Thanks.
I didn’t realize we had a Replace activity. We simply need to replace a particular text with “” using a suitable regex.

This is solved now. :slight_smile: