Replacing Closing Html Tags With Html Tag + \n
I'm trying to replace generally closing html tags with the closing tag + a line break, i found similar posts here on SO, none really helped me to accomplish what I'm looking for. &
Solution 1:
You have to capture the regular expression with brackets, assign the replaced string and replace ${1}
by $1
:
var regex = newRegExp("(</.*?>)", "gi");
strContent = strContent.replace(regex, "$1 \n ")
.replace(/\/>/g,'/> \n ');
Or you can simply put the replace
methods into the val
function.
Post a Comment for "Replacing Closing Html Tags With Html Tag + \n"