Dreamweaver cc logo
me@grafxflow

Written by me@grafxflow

16 Oct, 2012
12
16,617

How to remove blank lines in Dreamweaver

I was recently working on a website in Dreamweaver and had both PHP and CSS files with loads of blank lines of code, which needed to be deleted in order to make the files smaller.

So instead of doing it manually one at a time... which would have taken ages. I used a nice little tip in Dreamweaver.

1. Open the document you need to change.

2. Click CMD + F (Mac) or CTRL + F (PC).

3. In the Find and Replace window change the following:

Find in: to Current document

Search: to Source code

Find: input [\r\n]{2,}

Replace: input \n

Options: tick Use regular expression. It is slightly different in versions of cc 2016+ where you now need to choose the dropdown button on the top right - see the second picture below.

4. Finally select Replace All.

 CC 2015 and below

How to remove blank lines in Dreamweaver

 CC 2016 and above

How to remove blank lines in Dreamweaver CC

5. Optional - To make life easier just use the floppy disk icon to save the 'search and replace' settings for reference. Another tip: Make sure you also have 'current document' selected since it saves this setting as well.

Minor update for CC 2016+ the 'floppy disk save' is no longer available by default but can be activated by doing the following below options. IMPORTANT: You will need to edit this with another package other than Dreamweaver or you will keep loosing your changes.

 For Mac:

  1. Quit Dreamweaver
  2. Use finder to navigate to ~/Library/Preferences
  3. Open 'Adobe Dreamweaver CC [YOUR_VERSION] Prefs' using a text editor
  4. Find "[ADVANCED FIND AND REPLACE]" section and add "showhiddenoptions=TRUE"
[ADVANCED FIND AND REPLACE]
showhiddenoptions=TRUE
  1. Save and close the file
  2. Relaunch Dreamweaver

 For Windows:

  1. Quit Dreamweaver
  2. Open regedit
  3. Navigate to 'HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CC [YOUR_VERSION]\Advanced Find And Replace'
  4. Add a string value "ShowHiddenOptions=TRUE"
ShowHiddenOptions=TRUE
  1. Close regedit
  2. Relaunch Dreamweaver

It should now appear again as below but with different icons for 'Save Query' and 'Load Query'.

Show Save Query and Load Query in Dreamweaver CC

Share this article

Add comment...

12 Responses

George
12 Sep 2013

Thanks a lot. This helped.

Marianne
13 May 2014

Thank you so much. Adobe DW6 has a bug that creates empty lines every time you format your code (CSS). I couldn't figure out how to remove those from a large style.css. This gem is going into my code library. :-)

|

me@grafxflow
15 May 2014

Always glad to help.

Jerry Schrader
23 Jul 2014

Thanks! Very helpful

Malik Mudassar
08 Feb 2015

Bring your cheek, I wanna kiss you mate.

|

me@grafxflow
09 Feb 2015

Glad to help!

Mark Law
12 Mar 2015

Thanks, this is saved me a huge amount of time!

Amin
30 Oct 2015

Give this guy a cookie.... Thanks ...

Surbhi Jain
28 Mar 2016

Thank you so much. it saved my lot's of time :) :) :)

Prasadh
16 May 2016

wonderful... saved me a lot of time :) :) :)

thanks a ton....

Arvind Gondaliya
13 Jun 2018

Not proper work in js file.. Please infom me

|

me@grafxflow
13 Jun 2018

Hi Arvind,

I have tested this in the latest version of Dreamweaver and it works fine, just a different way of choosing 'Use regular expression' but I have added a new screen shot.

If this doesn't work can you go into more detail with what is happening?

Smart Search

me@grafxflow Author Profile picture

me@grafxflow

Founder, Grafxflow

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. I build lighting-fast dynamic content engines with Laravel, Winter CMS and Tailwind CSS. Thanks for stopping by!