Extract specific text from HTML code with Regex

Hello Everyone,

I want to extract 2 values with regex from my email body, but my problem is that this body comes from a tool that delivers this part in HTML.
Do you know how I can extract “Cause” and “Fin du projet” in this case? I’ve tried Regex but it doesn’t work.

Thanks


Hi @Maxime_LAUGIER

can you share the HTML code?

Regards

Hi @Maxime_LAUGIER

Try with the below regex expression:

(?<=\>)[\s\S]*?(?=\<)

Regards

Hello, thank you for your reply
i have no matches

Can you please share the HTML code?

Regards

@Maxime_LAUGIER

best is to use a split activity

str.Split({"<div>"},StringSplitOptions.None).Last.Split({"</div>"},StringSplitOptions.None).First.Trim

cheers

Hello @Anil_G ,

Thank you for your reply.
I don’t understand sorry, i am trying to search Split activity but can’t fint it.

Could you explain me a little bit?

Thanks

Here is the code :
“<link href="https://fonts.googleapis.com/css?family=Roboto:100,400\” rel="stylesheet"> \r\n\r\n\r\n <div class="body" style="background-color: #f4f4f4; color: #333333; font-size: 14px; padding: 50px 0;">\r\n <div class="container" style="background-color: #ffffff; border-radius: 14px; border: 1px solid #e4e4e4; margin-left: auto; margin-right: auto; padding: 30px; width: 670px;">\r\n \r\n <div class="label" style="color: #999999; font-size: 12px; text-transform: uppercase;">\r\n Cause\r\n \r\n

\r\n Fin du projet\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n\r\n"

@Maxime_LAUGIER
use </> from the editor when sharing code snippets

For HTML Extraction we would recommend: https://html-agility-pack.net/

Feel free also to give a try at:
grafik

1 Like

@Maxime_LAUGIER

drag a assign (str is the input string)

requiredstringvariable = str.Split({"<div>"},StringSplitOptions.None).Last.Split({"</div>"},StringSplitOptions.None).First.Trim

cheers

Hello ppr,

I tried this activity and it still the same.

Hi @Maxime_LAUGIER

try with the below regex:

(?<=\>)\s*[A-Za-z]+[A-Za-z ]+\s*(?=\<)

Regards

not really traceable for us as we dont know what was done in detail, and what was the input.
However, the Extract Text (from Html) can suffer from text glued together.

As mentioned:

If further assistance is needed then share with us the HTML as text file

Thank you @Anil_G , it’s works , amazing

Have a good day everyone

Thanks again

1 Like

If further assistance is needed then share with us the HTML as text file

i will do next time, thank you for your time

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