How to replace <br> with </p><p>

Is is possible to strip out some legacy <br> tags and replace them with </p><p>? A line break after the closing para would also be nice. And, can I target the asterisk and following space (see below) and delete it?

I’ve had a look at jQuery and managed to replace the br with p tags but they’re the wrong way round i.e. open then close as it just manipulates the DOM not my string.

The current code/text is supplied from a database I don’t have access to and the client doesn’t have the time (nor the inclination I would suspect) to amend it.

Old existing code:

<p>blah blah blah<br>* blah blah blah<br>* blah blah blah<br>* blah blah blah</p>

New code wanted:

<p>blah blah blah</p>
<p>blah blah blah</p>
<p>blah blah blah</p>
<p>blah blah blah</p>

Dr M

You’d be better off doing this on the server side, after the stuff is pulled from the DB and before being sent to the browser, e.g. with PHP. If you use JavaScript you might get ugly movement on the page as the BRs are removed and replaced by Ps, since they will have different styles.

I assume you want the line breaks so that people who look at the source see something pretty. I’m afraid the source they view will still be the old code. The only way to view the new source (after JS has operated on it) is by selecting everything on the page and then right-clicking and choosing “view selection source” (with Firefox - not sure about other browsers). Very, very few people will do it and most other stuff that JS has operated on will look ugly anyway (no line breaks or indentations).

Also, think about what will happen with users who have JS disabled.

That said, this can be done with JavaScript (and jQuery). However, if you do it on the server side, of course the above problems are all moot.

try this and let me know if it works:

<script type="text/javascript" src=""></script>
<script type="text/javascript">

@wolken: it did work. That’ll do nicely for a short term solution.

@Raffles, I have noted your comments and will get my colleague to sort it server side.

Thank you both for your speedy and informative replies.

Now I’m off to read jQuery: Novice to Ninja.