Remove </p> from a string

Hi guys,
I scrapped data from a page this element:

"Associate account manager - via Eric Brant

Start & end date to be defined when selected"

The return line between cant be removed by string.replace(environment.newline,β€œβ€) cause this 2 line are 2 paragraph < p ></ p >

Any idea? :cry:

str.Replace(β€œ

”, β€œβ€) to remove it :slight_smile:

1 Like

I tried before… nothing.:female_detective:

try System.Text.RegularExpressions.Regex.(strvar,"<.*?>",String.Empty)

3 Likes

Hi @Elya

Use the below expression

system.Text.RegularExpressions.Regex.Replace(str,β€œ\w\n”,β€œβ€).ToString

Where str is

"Associate account manager - via Eric Brant

Start & end date to be defined when selected"

Refer the below workflow for reference

Main (25).xaml (5.5 KB)
.

1 Like

@nadim.warsi @anil5 I tried the both method and this not working.
You can try with a html page with 2 paragraph like this.

< p >Associate account manager - via Eric Brant </ p >
< p >Start & end date to be defined when selected" </ p >

(</ p > I added i space the make this string visible)

So final string is this only right

After extracting from website can you provide how exactly will be the string

1 Like

Associate account manager - via Eric Brant

Start & end date to be defined when selected

HI @Elya,

I wanted after extracting the value from webpage, use write line and print this value, i wanted to see how UiPath is printing the value then only a regex can be written for that.

I had used this string in my workflow and provided you the output and if still not working then the issue is with the string.

Use this expression
system.Text.RegularExpressions.Regex.Replace(str,β€œ<.*?>”,β€œβ€).ToString

Where str is the string with p tags

I tried before and that doesn’t work. Unfortunately i can’t give the webpage from i get this string. But atleast, there u ll found screenshot.

image

Before & after (system.Text.RegularExpressions.Regex.Replace(str,β€œ<.*?>”,β€œβ€).ToString)

To Formated Data.xaml (9.5 KB)

Wow , i think the requirement is not to remove the

tag but to remove the html

formatting that happens.
@Elya can you tell me what is the output you are expecting? no new lines?

you need to do a line feed replace :slight_smile:

yourString.Replace(Environment.NewLine, String.Empty)

It was the first thing I did, and that doesn’t work. It why im here xD

can you help me with the paragraph data, ill hard code for now in your sequence and see how it runs.

I can’t provide you the html page. But you try with your own html page containt 2 simple paragraph.

1 Like

Elya,

I have worked through your code and now here is what is the result.
image

a small tweak to the expression
System.Text.RegularExpressions.Regex.Replace(io_dataFromJobPage("jobDescription"),"\t|\n|\r"," ").ToString

Attaching your xaml with the update.To Formated Data.xaml (10.5 KB)

2 Likes

Ty @nadim.warsi @anil5 to participate at this discussion. Finaly the β€œ\t|\n|\r” expression worked perfectly.:+1:

And that will be helpfull for next.

1 Like

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