Hi I have a html snippet that looks like *hi<br>*hello<br/>*test<br />
I want this to be preformatted using javascript as
*hi<br>
*hello<br/>
*test<br />
Is there a regular expression and javascript to do this.
Hi I have a html snippet that looks like *hi<br>*hello<br/>*test<br />
I want this to be preformatted using javascript as
*hi<br>
*hello<br/>
*test<br />
Is there a regular expression and javascript to do this.
str = str.replace(/<br>/g,"<br />\n");
This means replace all new lines \n with a <br />
Could you use replace() to replace * with *\n? You'd end up with an extra \n at the start but saves using regex.
If str is your HTML string
str = str.replace(/\n/g , "<br />");