How to remove white space while "find and replace" to remove code in Dreamweaver?

How to remove white space while “find and replace” to remove code in Dreamweaver?

Hello. I just want to remove a single line of code from all my documents. Using find and replace works fine but it leaves the white space in its place. Is there anyway to remove that white space along with the line of code? Thanks!

From personal experience with CS4, I have never heard of Dreamweaver having that feature, at least CS4. I would just run the page through a free editor that has that function. You would think Dreamweaver would do it anyway.

Paste the text in as unformatted text. This prevents the white spaces in your document but it means having to reformat all of the content as you will lose all the bolding, bullets, paragraphs, line breaks and italics from the original document. Not fun on a large document!

Hello Eric,

I have had to do this a bagillion times with different sites and have found a decent way that works for me. Consider the following:


<div class="someDiv">
    ....some content...
</div>
    <div id="removeDiv">
        ... more random content...
    </div>
<div id="footer">
    ...footer content...
</div>

What I do to remove the div called “removeDiv” in this case, is highlight everything from the </div> of the div “someDiv” all the way through the opening of the “footer” div. Now paste that into your find window.

in the replace window, simply replace it with the </div> from “someDiv” and the opening of “footer” div with no space inbetween.

Choose replace all and make sure in the options of the find and replace are set to “source code” and entire current local site" and you should get something like:


</div> <!-- from the "someDiv" -->
    <div id="footer">

This works for me in dreamweaver CS4 and has worked great for the most part since Dreamweaver 8.

hope this helps.