EmEditor (text editor) Forum Index
   Questions and Answers about EmEditor Core
     Irregularities with replacing (.jsee macro)
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
Salabim
Posted on: 2/21/2013 9:42 pm
Quite a regular
Joined: 9/5/2009
From: Ghent (Belgium)
Posts: 58
Irregularities with replacing (.jsee macro)
Hi,

I encounter a problem when running a .jsee macro not matching where it *should* . I need to run the macro twice in order to have all the words replaced as they should.

Here's the textfile for testing purposes (the macro should replace all "l" chars at the beginning of every line, however it skips some, and only replaces them when the macro is ran a 2nd time)


lerse
ler
lers
lerland



This is the macro-script that should match at *every* line.

document.selection.Replace("(\\r\\n|-|<i>|,| )ler(s|se|land|)( |</i>|,|\\.|!|\\?|(\\r)*\\n)","\\1Ier\\2\\3",eeFindNext | eeReplaceAll | eeFindReplaceRegExp);


Can you please try to reproduce, and see what I mean please ?
Yutaka
Posted on: 2/22/2013 9:39 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: Irregularities with replacing (.jsee macro)
Hello Salabim,

This is an expected result. Since you are trying to match from a new line character (\n, \1) to the next \n (\3), the next search will begin after the second \n (\3). For instance, after "\nler\n" is matched, the following search will begin at "lers".

If you need to search every line, you will need to remove either \1 or \3, or you might want to use lookahead or lookbehind search. Please see

http://www.emeditor.com/help/howto/search/search_regexp_syntax.htm

for details about the syntax of regular expressions.

I hope this helps you understand.

Thanks!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Salabim
Posted on: 2/23/2013 4:56 pm
Quite a regular
Joined: 9/5/2009
From: Ghent (Belgium)
Posts: 58
Re: Irregularities with replacing (.jsee macro)
Oh! I see now.
Duh, sorry me. Thank you very much for pointing out my error, Yutaka.


EDIT: Just a followup question.

I have a .jsee with quite some text replacing lines, it's for fixing commonly made mistakes in .srt (subtitle) files.

Would it be a bad idea if i change all instances of "eeFindNext" into "eeFindAround" in that .jsee file ?
Threaded | Newest First Previous Topic | Next Topic | Top


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