Remove characters

Hello, I have a string that should contain only letters, numbers, “-”, and"/".
I would like to remove all other characters.

assign this to a string variable e.g. resultString
resultString = System.text.regularExpressions.Replace(inputText, "([^\dA-Za-z-\/])"

where inputText is the variable containing the string

resultString will be inputText minus those characters that should be removed

Hi @tomaz

Try this

str = System.text.regularExpressions.Replace(str, "[^\s\w/-]+","")

str is the input string can assign it to same

cheers

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