javascript replace p tags with new line

JavaScript
str = str.replace(/<p>(.*)<\/p>/g, "$1\n"); 
Source

Also in JavaScript: