- AuthorPosts
- March 24, 2010 at 6:19 pm #8216jowraMember
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.
March 24, 2010 at 8:13 pm #8217Yutaka EmuraKeymasterHello 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!
March 24, 2010 at 8:33 pm #8218jowraMemberThat works perfect!
Thank you Yutaka!
- AuthorPosts
- You must be logged in to reply to this topic.