EmEditor (text editor) Forum Index
   Questions and Answers about EmEditor Core
     convert special characters to english characters
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
dmitryl
Posted on: 3/3/2012 7:30 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: convert special characters to english characters
Peter ,

Wanna to share your code?
ToadLoadin
Posted on: 3/3/2012 5:16 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: convert special characters to english characters
I just found that both of the two macro above is not perfect due to lack of checking the setting whether "regular expressions can match new line characters" or not...

ToadLoadin
Posted on: 3/3/2012 4:57 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: convert special characters to english characters
I think it could be done with this macro:

// If nothing selected, select all.
var currentSelection = getSelection();

// A find'n replace using regular expression
// (in selected range only).
currentSelection.Replace("^\\s*$\\n", "", eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);

// earase search keyword highlighting.
document.HighlightFind = false;


Then, you could use this macro to insert empty lines between each "none-empty" line (forgive my poor english):

// If nothing selected, select all.
var currentSelection = getSelection();

// A find'n replace using regular expression 
// (in selected range only).
currentSelection.Replace("\\n", "\\n\\n", eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);

// earase search keyword highlighting.
document.HighlightFind = false;
dmitryl
Posted on: 3/3/2012 3:47 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: convert special characters to english characters
Thank you!

Now how is it possible to remove double (or more) empty lines?

Thank you again for any response!
ToadLoadin
Posted on: 3/3/2012 3:01 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: convert special characters to english characters
You can find it here.
dmitryl
Posted on: 3/3/2012 12:10 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: convert special characters to english characters
Any help for removing characters using JavaScript?
pja
Posted on: 3/2/2012 5:18 pm
Just popping in
Joined: 2/15/2008
From: Batemans Bay, NSW, Australia
Posts: 20
Re: convert special characters to english characters
Yutaka,

I have just used this technique to write a snippet/macro that changes curly quotes (single and double), sort and long dashes into their equivalent keyboard characters.

In the past I have had to do this as a series of "Find and Replace" tasks. Now its a simple highlight the text and click on the snippet.

Thank you very much for the tip.

Regards,
Peter


----------------
There is nothing more difficult to take in hand, more perilous to conduct, or more uncertain in its success, than to take the lead in the introduction of a new order of things -- Niccolo Machiavelli, The Prince, ch. 6

dmitryl
Posted on: 3/1/2012 9:54 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: convert special characters to english characters
Hi all,

1) What command should be used for removing a character?

2) How to replace double (or more) empty lines with a single empty line?

Thank you!
ToadLoadin
Posted on: 2/16/2012 2:56 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: convert special characters to english characters
I guess while recording the macro, if you turned case sensitive on, it will also be recored into the macro code.
user
Posted on: 2/16/2012 1:50 am
Home away from home
Joined: 9/29/2006
From:
Posts: 212
Re: convert special characters to english characters
it seems to work very well, thanks!

but how do I specify the case-sensitive action?

(1) 2 »
Threaded | Oldest First Previous Topic | Next Topic | Top


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