16 Oct
2012

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
CC 2016 and above
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:
- Quit Dreamweaver
- Use finder to navigate to ~/Library/Preferences
- Open 'Adobe Dreamweaver CC [YOUR_VERSION] Prefs' using a text editor
- Find "[ADVANCED FIND AND REPLACE]" section and add "showhiddenoptions=TRUE"
[ADVANCED FIND AND REPLACE]
showhiddenoptions=TRUE
- Save and close the file
- Relaunch Dreamweaver
For Windows:
- Quit Dreamweaver
- Open regedit
- Navigate to 'HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CC [YOUR_VERSION]\Advanced Find And Replace'
- Add a string value "ShowHiddenOptions=TRUE"
ShowHiddenOptions=TRUE
- Close regedit
- Relaunch Dreamweaver
It should now appear again as below but with different icons for 'Save Query' and 'Load Query'.


me@grafxflow
Visitors also viewed these posts
12 Thoughts
12 Sep
2013
George
Thanks a lot. This helped.13 May
2014
Marianne
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. :-)15 May
2014
me@grafxflow
Always glad to help.23 Jul
2014
Jerry Schrader
Thanks! Very helpful08 Feb
2015
Malik Mudassar
Bring your cheek, I wanna kiss you mate.09 Feb
2015
me@grafxflow
Glad to help!12 Mar
2015
Mark Law
Thanks, this is saved me a huge amount of time!30 Oct
2015
Amin
Give this guy a cookie.... Thanks ...28 Mar
2016
Surbhi Jain
Thank you so much. it saved my lot's of time :) :) :)16 May
2016
Prasadh
wonderful... saved me a lot of time :) :) :)thanks a ton....
13 Jun
2018
Arvind Gondaliya
Not proper work in js file.. Please infom me13 Jun
2018
me@grafxflow
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?