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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
brf10043
Creator
Creator

Remove unwanted text from a String

I'm pulling data from a sharepoint list and some of the text has extra unwanted characters.

How would I remove ​"<span aria-hidden="true"></span>" from the string below

<span aria-hidden="true"></span>Lets all work 3 days a week

or

remove everything except "Lets all work 3 days a week" from the string below?

<div class="ExternalClass450FFA875469469B9098549F4A621B80"><p>​<span aria-hidden="true"></span>Lets all work 3 days a week</p></div>

16 Replies
brf10043
Creator
Creator
Author

Unfortunately,  I'm not sure this will work.  We have hundreds of users and I will not be able install a macro for each one.

Unless I can set it up on the original file and it would work for the users using AJAX in IE.

devarasu07
Master II
Master II

Hi,

Another solution using qlikview script method (no macro in this method)

temp:

LOAD * INLINE [

Field

<div class="ExternalClass450FFA875469469B9098549F4A621B80"><p><span aria-hidden="true"></span>Lets all work 3 days a week</p></div>

];

Data:

LOAD RecNo() as RecNo, Field  Resident temp;

drop table temp;

HtmlTag_Map:

MAPPING LOAD DISTINCT '<' & TextBetween('<' & SubField(Field, '<'),'<','>') & '>' as HtmlTag, '' as Substitute

Resident Data;

JOIN(Data) LOAD RecNo, MapSubstring('HtmlTag_Map', Field) as Field_Cleansed

Resident Data;

3.JPG

For more details, refer

Removing HTML markup code

rbecher reply

vinieme12
Champion III
Champion III

The below works

EDITTEXT:

Mapping Load * inline [

From,to

>,@{

<,}@

];

LOAD

textbetween(Mapsubstring('EDITTEXT',replace(FIELDIS,'><','_')),'@{','}@') as FieldIS

;

LOAD if(Match(right(Trim(FIELDIS),1),'>')=0,FIELDIS&'<',FIELDIS) as FIELDIS inline [

FIELDIS

<div class="ExternalClass450FFA875469469B9098549F4A621B80"><p><span aria-hidden="true"></span>Lets all work 3 days a week</p></div>

<span aria-hidden="true"></span>Lets all work 3 days a week line 2 test

];

stripHTML.JPG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vishsaggi
Champion III
Champion III

I dont know your column name so hardcoded it. You can use your column name like

= Subfield(Subfield(ows_TO_x002d_BE, '</span>',2), '<')


When you say it is not always the same text, i know it wont be but will that text be between

</Span>  ......  </P>    always or what are the combination of tags you have to look to pull your text. Can you share some sample data or example html tags. ?

brf10043
Creator
Creator
Author

Sorry,  I probably should have given you guys more information.

When I load ows_TO_x002d_BE, and load it into a table object I get the following.

I then tried this load  TextBetween(ows_TO_x002d_BE, '<p>', '</p>') which resulted in

It works for two of my cells but not the middle one.  It sill has the extract character string.  I am not sure why the middle row has additional extra characters.

I really appreciate your assistance.

vinieme12
Champion III
Champion III

If you try the script exactly the way I have posted, it'll work

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sumitjadhav
Creator II
Creator II

Hi Bobby,

Try this Expression,

-->> SubField(SubField(SubField(Field,'</span>',2),'><',1),'<',1)

It Will Produce an Output:

subfield111.JPG

Thank's & Regards,

Sumit Jadhav.