Replace characters with nothing using Regular Expression pattern in Type into activity (Type this)

Hello!

Could someone help me with this problem?
I’m writing this expression in a Type Into activities - Type this, in order to eliminate some characters from my text

System.Text.RegularExpressions.Regex.Replace(CurrentRow(“Descrierea “).ToString, “<(?:”[^”]“['”]|‘[^’]‘[’"]|[^'”>])+>“,”").ToString

The pattern is not well read and a small red sign appears indicating that a ‘)’ is expecting; I tried with escape , but it doesn’t work.

As a remark, I’ve made a test using a simple pattern as [0-9], and there is no error.

Thank you very much for your help!

image

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

Hello @Ruxandra_Zamfir

Can you try with the matcth and replace activities to resolve this.

please use the format </> button from editor, otherwise we cannot see the pattern correctly.
Also let us know on SOP sample / output / targeted Pattern description on what is to achieve

Can you Place your characters here which you want to eliminate from your string?

Hi,

Maybe the following expression works as you expect.

System.Text.RegularExpressions.Regex.Replace(CurrentRow(“Descrierea “).ToString,"<(?:""[^""]""['""]|'[^']'['""]|[^'"">])+>","")

Regards,

In fact, it is about a datatable, I tried to use Replace activity, but I had errors about converting Datatable to String- it seems Replace activity works only with String.
I tried to use Output DataTable, but it didn’t work, I had errors.
Thank you!

Hello!
It is like this:

text

text

text

Thank you!

Well, I think I have a problem, it is about some html signs, and there are not seen there.

How can I write them without be seen as html?

You can type in Notepad and share screenshot here.

Whats the error that you are getting while converting to string using output datatable?
It should work fine if you are converting from datatable to string.

Thank you, Yoichi! It seems it is not enough, the element [<p “=”">] is is not seen.
Remark : the element is without .
In fact, it is right here the error appears, on this element.

It is like this!
Thank you!

And what is your expected output from this string?

image

this is the Regex

Thank you!

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Replace(CurrentRow("Descrierea ").ToString,"<(?:""[^""]*""['""]*|'[^']*'['""]*|[^'"">])+>","")

Regards,

I need to keep only the text, and not the html signs. I will write this text exported from an application in another web application. So, I need a clean text. I receive it with html signs.

Thank you!

<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>

maybe you can change the strategy
grafik

then just remove / filter out matches with empty string content and trim the matches

I find this and it works.

Thank you everyone for your replies.

Ruxandra