Search the entire html document for an exact code & ldquo; & lt; br & gt; foo & lt; br & gt; & rdquo; and delete it


I have a page which has exactly <br>foo<br> several times in different parts of its code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    The quick brown <br>foo<br> fox jumped over the lazy <br>foo<br> dog.

But I need the page to say:
The quick brown fox jumped over the lazy dog.

Rather than:
The quick brown
fox jumped over the lazy

I need it to keep deleting the <br>foo<br> even if I later add more text and more <br>foo<br>

Please provide a full functional code, hopefully php

Additional information:
I am loading much of the text through php includes.
I don't want to have to declare the original string in php, I want the php to check the html code and delete a specified string.

You can't do what you're asking with PHP unless the string is being output by PHP...

I suppose you could use javascript for this; for example (using JQuery):

        var old_body = $('body').html();
        var new_body = old_body.replace(new RegExp("<br>foo<br>", "g"),'');

However, it really would be better if you used one of the methods described already and pass the content through PHP.

Updated to actually work...