Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Regex Find & Replace - Remove Empty Lines

Community Expert ,
Jul 27, 2018 Jul 27, 2018

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.

Paul-M - Community Expert
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 28, 2018 Jul 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

Translate
Community Expert ,
Jul 27, 2018 Jul 27, 2018

This appears to work:

https://www.brmecham.com/how-to-remove-blank-lines-in-dreamweaver/

Paul-M - Community Expert
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 28, 2018 Jul 28, 2018
LATEST

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines