dip s

dip s

  • NA
  • 256
  • 82.4k

How to use replace function for multiple occurrences.

Apr 17 2020 7:01 AM
Hello,
I have a string in syncfusion rich text box which is  "This is a good forum
So in rich text box it is interpreted as  
 
MyString = <p><span style="text-decoration: underline;">This</span> is a good <span style="text-decoration: underline;">forum</span></p> 
 
Now, i want to use replace function in angular 6.
I want to replace  <span style="text-decoration: underline;">  with <u>
In MyString its coming 2 times but when i use replace function it replaces only 1st occurrence.
and 2nd occurrence remains as it is.
So how can i replace all occurrences.
  1. FormattedDesc =MyString.replace('<span style="text-decoration: underline;">''<u>');  
Please any help would be appreciated. Thank you. 

Answers (3)