Over the years, I have never understood why some files that are not double-spaced, mysteriously open with a line space between each line of code in Dreamweaver.  I used to take the tedious time hitting “Backspace” and the up arrow key in rapid fire manner to get back to beautiful single-spaced code.

However, since learning how to do regular expression searches, I can now share with you how to get rid of these extra lines.

Steps to removing double spacing from Dreamweaver code:

  1. Open “Find and Replace” in Dreamweaver
  2. Check “Use Regular Expressions”
  3. Enter [rn]{2,} in the find box.  This will search for double line breaks in your code.
  4. Enter n in the replace box.  This replaces the double line break with a single break.
  5. Press “Replace All” and you’re good to go!

search-replace-dreamweaver.png

 

Want to make sure this doesn’t happen again?

Steps to prevent Dreamweaver from inserting blank lines or double spaces in the future:

  1. In Dreamweaver, go to “Preferences”
  2. Go to “Code Format” on the left hand side
  3. Change the “Line Break Type” to match your server’s operating system.  In most cases, this is Linux.