Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10850
    Salabim
    Participant

    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("(rn|-|<i>|,| )ler(s|se|land|)( |</i>|,|.|!|?|(r)*n)","1Ier23",eeFindNext | eeReplaceAll | eeFindReplaceRegExp);

    Can you please try to reproduce, and see what I mean please ?

    #10851
    Yutaka Emura
    Keymaster

    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 “nlern” 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!

    #10859
    Salabim
    Participant

    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 ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.