Need to remove special characters from string

Hi Team,
I need to remove specified special characters from string.

~ ? ā€™ " # | & / \ % * < > : these should be removed and I need to keep the other special characters.

Can anyone help me to resolve this thanks.

@nagini.pragna
Replace with space through regex
*|?|'|"|#|&|/|\|<|>|:
->System.Text.RegularExpressions.Regex.Replace(yourString,ā€œ*|?|'|ā€|#|&|/||<|>|:", ā€œā€)

image

1 Like

Hi @nagini.pragna ,

Use the below expression:

system.text.RegularExpressions.Regex.Replace(YourString,ā€œ[~ ? ā€™ ā€œā€ # | & / \ % * < > :]ā€,ā€œā€)

1 Like

@nagini.pragna use this
System.text.regularExpressions.Regex.Replace(yourString, "(["+Chr(34)+"~\?\'#|&\\\/%\*<>:])", "")

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.