Saturday, 28 January 2012 08:46

Cleaning code in Dreamweaver

Written by 
Rate this item
(4 votes)

When I am editing html or php files when creating my templates, I use Dreamweaver. I have had it for years and it has always worked for me, but there has always being an annoyance.

More often than not, when the file is downloaded from the server to local copy and then opened for editing, a mass of empty lines are added between each code line, bulking out the code.
My OCD kicks in and I have to clear up these blasted blank lines, but it is tedious and takes a lot of time, now I have found a solution.

So if you use Dreamweaver and wish to remove the excess blank spaces, give this a try.

  1. Open the file in Dreamweaver
  2. Press CTRL + F to open the Find and Replace tool
  3. Select Current Document in the Find In selector
  4. Select Source Code in the Search selector.
  5. Make sure the checkbox calle Use Regular Expression is enabled.
  6. In the Findbox, type:  
    • [\r\n]{2,} 
  7. In the Replace box, type: 
    •  \n
  8. Press the Replace All button.

After a few seconds, depending on how severe the clean up is, all those rogue blank spaces will be gone.

Hope someone finds this useful.

Read 65198 times