I get errors when I try any of the following:
str = str.replace(/</p>/gm, "")
str = str.replace("</p>"/gm, "")
What am I doing wrong?
I get errors when I try any of the following:
str = str.replace(/</p>/gm, "")
str = str.replace("</p>"/gm, "")
What am I doing wrong?
Share Improve this question edited Nov 17, 2011 at 2:54 makes 6,5483 gold badges42 silver badges59 bronze badges asked Nov 16, 2011 at 14:53 Simple SimonSimple Simon 7223 gold badges9 silver badges23 bronze badges3 Answers
Reset to default 6The '/' is a special character that you have to escape it within the regex:
str = str.replace(/<\/p>/gm, "");
tr = str.replace(/\<\/p\>/gi, "")
You have to escape the backslash character.
str = str.replace(/<\/p>/gm, "");
See example here.