How To Remove "Some" Special Characters from String


There are a lot topics discussing a way to remove special characters, I got all different scenarios, except this time I want to remove only some of them not all, How to achieve that , In my case I want to keep “€”, “%” and remove others ? Thanks in advance

Try This

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

1 Like

Thanks @Ayman_Alabsi1 , Is there a way to keep the text as it is in the file, I see after executing the above , words are OK separated by empty space but all lines are joined together ? By another way, How to Remove those Special Characters without Impcating Text Formatting? Thanks in advance

Hi @hsendel

can you share sample data to check it?

1 Like

Sure, in 15-20min :+1:

1 Like

Hi @Ayman_Alabsi1 , Here it is .
Sample.txt (1.7 KB)

1 Like

you can check this solution

sample.xaml (7.9 KB)

1 Like

Thanks @Ayman_Alabsi1 , I goth the following error message, probably you have recent version of “Read/Write Activities” than me, no?

I used Read/Write Activities for the testing purpose you can remove them and prepare the solution based on your business.
and if your solution needs Read/Write Activities you can remove them and pass new activities to compatible with uipath version.


Excellent @Ayman_Alabsi1 :+1:

1 Like

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