javascript replace p tags with new line code example Example: javascript replace p tags with new line str = str.replace(/<p>(.*)<\/p>/g, "$1\n");