dip s

dip s

  • NA
  • 256
  • 81.2k

How to Find and replace both open and close tag with new tags

Jul 3 2020 1:38 AM
Hello,
Hope you all are safe!!!
 
I have a angular application where I have used syncfusion's rich text editor for client's report with bold, Italic and underline. When I print report, it shows only bold and Italic text. The text with underline formatting does not get printed.
So to print Underline text I have to replace their tags with some other tags. So how to do that?
 
This is my input string 
 
  1. <span style="font-family: Arial, Helvetica, sans-serif;"><span style="text-decoration: underline;">This is the best way</span></span>  
 
In above string I have to replace 
  1. <span style="text-decoration: underline;">  
 with 
  1. <u>  
tag
 
and its closing tag </span> with </u> tag
 
So I am expecting output string as 
 
  1. <span style="font-family: Arial, Helvetica, sans-serif;"><u>This is the best way</u></span>   
 
 
But how to find this closing tag </span>.
As there are two closing span tag</span> 
 
 
 Any help would be appreciated. Thank you

Answers (12)