Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting the text from html code

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

2 Replies
swuehl
MVP
MVP

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>'))

)

Anonymous
Not applicable
Author

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 ''.