Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is there any easier/best way to get the text from the html code.
I have the data in html code and need to fetch the data alone from that code.
Data will look like
<div class="ExternalClass124344545235"><body><p>Hi,</p><p></p><p>Nice idea! Especially now, when there has been a lot of talk here about the quality of a product.</p><p></p><p>It would be better if you release the model in the site...</p><p></p><p>BR,</p><p>Mathew</p></body></div>
I have to fetch the comment alone from this tag. Output should be Hi, Nice idea! Especially now, when there has been a lot of talk here about the quality of a product. It would be better if you release the model in the site...Mathew
Note: Based on the comments given, the number of <P> and </P> tag will vary
I copied your text in a variable vText (could also be a field), then used:
=concat(
TextBetween(vText,'<p>','</p>',ValueLoop(1,SubStringCount(vText,'</p>')))
,'',
ValueLoop(1,SubStringCount(vText,'</p>'))
)
Sounds messy, but I would do it like this:
=replace(replace(TextBetween('<div class="ExternalClass124344545235"><body><p>Hi,</p><p></p><p>Nice idea! Especially now, when there has been a lot of talk here about the quality of a product.</p><p></p><p>It would be better if you release the model in the site...</p><p></p><p>BR,</p><p>Mathew</p></body></div>','<body>','</body>'), '<p>',''), '</p>','')
So TextBetween() to pick everything between <body> and </body>. Then use Replace() to replace <p> and </p> with ''.