1

Here is what I am getting as a string. I need to put this inside a <p> but not able to find any solution

An investment strategy that's sosimple&#160;and so&#160;effective, we call it the "magic portfolio." It's a way to&#160;guarantee&#160;that you will beat the market.

I was using

return text.replace(/(<[^>]+>)/g, "");
deceze
  • 510,633
  • 85
  • 743
  • 889
Subhabrata Banerjee
  • 442
  • 1
  • 4
  • 18
  • It looks like you want to decode HTML entities. Does https://stackoverflow.com/questions/1912501/unescape-html-entities-in-javascript/34064434#34064434 work for you? Otherwise, if you just want to remove exactly that. have you tried simply using `return text.replace(/ /g, "");`? – Emre Koc Aug 25 '20 at 06:27
  • 2
    That's a regular expression that strips tags, not entities. – tadman Aug 25 '20 at 06:28
  • is it possible to merge return text.replace(/ /g, ""); with return text.replace(/(<[^>]+>)/g, ""); I actually tried with text.replace(/(<[^>]+>)/ /g, ""); and its not working. If I am doing text = text.replace(/ /g, ""); return text.replace(/(<[^>]+>)/g, ""); working perfectly but If I can merge it will be helpful – Subhabrata Banerjee Aug 25 '20 at 06:38

1 Answers1

0

Try to use text.replcae(your reg expression).replace(your reg expression)