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:
YourVariable.replace(“:”,“”)
Hey
just use
strInput.Replace("-", String.Empty).Replace("(", String.Empty).Replace(")", String.Empty) etc..
Regards!
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.
Thanks,
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.
\w+\d+
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 :
String.Join("",StrVar.Where(Function(c)Char.IsLetterOrDigit(c)).ToArray)
Let us know if this doesn’t work and provide samples where it doesn’t work.
Thank you for your help, yes its working.
Thanks,
its working.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.