EmEditor (text editor) Forum Index
   Enhancement Suggestions about Plug-ins
     remove empty characters
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
user
Posted on: 12/23/2011 2:09 pm
Home away from home
Joined: 9/29/2006
From:
Posts: 212
remove empty characters
hello!

I would like with one click to:

1) automatically replace all two or more spaces with one space, two or more tabs with one tab
2) automatically delete spaces and tabs at the begining or end of lines

any help?

thanks!
Cirillo
Posted on: 12/24/2011 8:23 am
Not too shy to talk
Joined: 7/2/2010
From:
Posts: 21
Re: remove empty characters
Hello user!

You may want to use the following .jsee macro

//---Begin Macro---
Window.Redraw = false;

// remove trailing blanks (whitespaces, tabs ecc.) & their combos
document.selection.Replace ("(\[\[:blank:\]\]){2,}", "\\1", eeFindReplaceRegExp | eeFindAround | eeReplaceAll | eeFindReplaceQuiet);

// remove StartOfLine blanks
document.selection.Replace ("^\[\[:blank:\]\]", "", eeFindReplaceRegExp | eeFindAround | eeReplaceAll | eeFindReplaceQuiet);

// remove EndOfLine blanks
document.selection.Replace ("\[\[:blank:\]\]$", "", eeFindReplaceRegExp | eeFindAround | eeReplaceAll | eeFindReplaceQuiet);

document.selection.StartOfDocument (false);
document.HighlightFind = false;
Window.Redraw = true;
//---End Macro---


Hope this will help.
dmitryl
Posted on: 3/17/2012 1:34 pm
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: remove empty characters
How is it possible to remove empty/blank lines in the end of the file (or to leave just one empty/blank line)?
Thank you!
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文