Written by me@grafxflow
16 Oct, 2012
12
15,787
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.


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.
[ADVANCED FIND AND REPLACE]
showhiddenoptions=TRUE
ShowHiddenOptions=TRUE
It should now appear again as below but with different icons for 'Save Query' and 'Load Query'.

30 Oct, 2016
20 Sep, 2012
03 May, 2017
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. Thanks for stopping by!
Follow20 May, 2025
11 Jul, 2023
Views: 172,828
Views: 74,083
Views: 73,172
Views: 47,493
12 Response