Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8216
    jowra
    Member

    Hello!

    First of all, thank you for this great editor!

    Currently I’m trying to write my frist macros and would like to find and replace some strings:

    For example search for: (1) or (2) or (3) and so on…

    I would like to replace such a string with: absatz

    So for the moment I’m just trying the Find method and use the following:

    document.selection.Find(“(.)”, eeFindNext | eeFindReplaceRegExp);

    But that macro “finds” all characters, since only the dot-operator is used. But if I use this regular expression in the replace-dialog it works like it should be. I’ve tried other combinations in the macro, for instance [0-9] finds all numbers, thats correct, but as soon as I use the blackslash-char, it is simply ignored.

    And if – for testing reasons – I search for a simple string that works and would like to replace it with a LaTex-command like section, the backslash is ignored again even if I use section.

    Am I doing something completly wrong?

    Thanks for any hint.

    #8217
    Yutaka Emura
    Keymaster

    Hello jowra,

    Thank you for using EmEditor!

    If you use JavaScript macros, you will need to escape a backslash as four backslashes like ‘\’. This is because Regular Expressions need one escape, and then JavaScript language also needs one escape.

    I hope this makes sense you. If you have further questions, please don’t hesitate to ask me. Thanks again!

    #8218
    jowra
    Member

    That works perfect!

    Thank you Yutaka!

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