Skip to main content
Legend
July 28, 2018
Answered

Regex Find & Replace - Remove Empty Lines

  • July 28, 2018
  • 2 replies
  • 4233 views

Anyone got a tried and tested find and replace regex for removing empty lines in DW 2018 please?

This seems to find empty lines:

^(?:[\t ]*(?:\r?\n|\r))+

But if I leave the replace field empty and click replace all - nothing happens.

This topic has been closed for replies.
Correct answer B i r n o u

the expression that you had enter so far is working good at least in many text editor but in dreamweaver

as you point at the [\r\n]{2,} replaced by \n can do the job, but will avoid lines starting by a TAB char... (it often happen in code text)... perhaps adding a \t starting the square bracket will help to catch them

2 replies

B i r n o u
B i r n o uCorrect answer
Legend
July 28, 2018

the expression that you had enter so far is working good at least in many text editor but in dreamweaver

as you point at the [\r\n]{2,} replaced by \n can do the job, but will avoid lines starting by a TAB char... (it often happen in code text)... perhaps adding a \t starting the square bracket will help to catch them

Paul-MAuthor
Legend
July 28, 2018
Paul-M - Community Expert