Skip to main content
Legend
Jul 28, 2018 3:32 AM UTC
Answered

Regex Find & Replace - Remove Empty Lines

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 is closed to new replies. Start a new post to keep the conversation going.
B i r n o u
B i r n o uCorrect answer
Legend
Jul 28, 2018 3:37 PM UTC

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
Jul 28, 2018 3:37 PM UTC

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

Translate
Paul-MAuthor
Legend
Jul 28, 2018 3:35 AM UTC
Paul-M - Community Expert