How to seperate special characters in string

I have to extract this string ‘CRQ00000785’ from the email subject, which I have managed to extract, but how to remove other characters like ‘(CRQ00000785)’, ‘:CRQ00000785’ , ‘-CRQ00000785’ , etc?
I only want to include CRQ00000785, not any other characters, how can I achieve it without using regex expressions?

Why not regex? You could just replace every chracter with nothing:



just use

strInput.Replace("-", String.Empty).Replace("(", String.Empty).Replace(")", String.Empty) etc..


1 Like

Hi @automated

You can use the Replace activity in UiPath to achieve this. You can set the text to the email subject, then set the “Old value” parameter to “(CRQ00000785)”, “:CRQ00000785”, “-CRQ00000785”, etc. and set the “New value” parameter to an empty string (“”). This will replace all of the characters you want to remove with an empty string, leaving only the string “CRQ00000785” in the email subject.


Hi @automated ,

Using Regex would be a better option as we understand that the requirement is for Alphanumeric values and you have already extracted the part and would want to remove the unwanted characters along with it.



However, If Looking for a String operation only, we could also Leverage the char.IsLetterOrDigit to keep only the Alphanumeric characters in the extracted String like shown below :



Let us know if this doesn’t work and provide samples where it doesn’t work.

Thank you for your help, yes its working.

1 Like

its working.

1 Like

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