How do i remove special characters from a string?

hi all,
i have seen it been done using REGEX but i would like to know how to do it without as mine doesn’t appear to be working

Thank you

1 Like

Can you be a little more specific, how is your string and what to you want to remove from them?

@Rowley101

REGEX would be helpful here. But if you don’t want to use it then use Replace method to replace special characters.

my string should be RQ8000767352 but when i scrape its not accurate and reading invisible text like [RQ8000767352)

is there a reason why when i start typing regex that is doesn’t show up in the suggestions?

that would be “[RQ8000767352)”.Replace("[","").Replace(")","")

@Rowley101

You need to try below way.

          System.Text.RegularExpression.RegEx
1 Like

yes but the ocr is quite unstable so for the next record is might read it as $RQ86664527^

are you saying you want to always clean first and last? what do you know about that string? does it have always the same size and should always start with R?

System.Text.RegularExpressions.Regex.Replace(variable, “[^a-z A-Z]”, “”)
?
how do i include numbers 0-9 as the characters i want?

1 Like

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

3 Likes

and you pray that ocr will never give you a letter or a number in the wrong place :slight_smile:

1 Like

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