How to remove extra blank lines in your script using Dreamweaver

You may have come across many a times when your FTP client or some editor may add extra blank lines to your script which become a nuisance to you and others working on that script. I know I get very frustrated if this happens.

However there is a solution for this and I came across this website and it worked like a charm.

I am reproducing the lines here for everyone.

  • Click CTRL + F
  • Select “Current document” in “Find in” (You can also select the folder if you have multiple files)
  • Search in “Source code”
  • Tick “Use regular expression”
  • Type “[\r\n]{2,}” (without quotes) in “Find”
  • Type “\n” (without quotes) in “Replace”
  • Press “Replace All”

I usually select the folder where my scripts reside and replace all the files in one go so that I don’t have to do it individually for each file.

I hope the above helped.