How to remove empty lines in code using Dreamweaver image
Posted on 23 Apr 2016

How to remove empty lines in code using Dreamweaver

Today I came across another problem. My code was supposed to be just over 400 lines but instead it was like over 1000 line. I started wondering how can I remove the unnecessary empty lines from my code. I wanted to give it a try and decided to use a regular expression for it. Here are step by step instructions.
  1. Open your code in Adobe Dreamweaver.
  2. Make sure you are on the code view of Dreamweaver
  3. From Edit Menu, select Find and Replace or use a short cut key (command+F on Mac or Ctrl+F on Windows)
  4. Under 'Find in' you can select 'current document' if you would like to remove empty lines only from current document. Alternatively you can select 'open documents' to remove empty lines from all documents currently opened in Dreamwaever.
  5. Under 'Search' you can select 'Source Code'
  6. In the find box type [\r\n]{2,}
  7. In the replace box type \n
  8. Make sure the 'use regular expression' is ticked
  9. Select 'Replace All' button
Above steps will remove all the blank lines between your code. If you can't find the above steps, here is a picture.

How to remove empty lines in code using Dreamweaver