My question is, after the replace command, shouldn’t the target range refer to the replacement text according to the documentation, which should be (start = 66, end = 71), since it replaced with 5 characters. But from the result above, I’ve gotten (start = 0, end = 136), can anyone explain to me what am I doing wrong? Or is this a bug?

I’ve just now realized that in the title I typed editor.rereplace but in the example I actually used editor.replaceTargetRE, but just for people who are wondering, I do get the same weird result no matter which command was used.

@dail
I’ve just tried the same commands on a separate computer which doesn’t have Python Script or LuaScript installed before. So for the test, only LuaScript plugin is installed…but the result came back wrong as well (same weird result).

Same here. I’m honestly not sure what is going on then. As per the Scintilla documentation the target should be the start/end. My only guess is that there is some Notepad++ setting that is messing up the target range.

@dail
Good news, mystery solved. Now I can re-create this weird behavior of the replace function on your side as well. Simply go to Settings. Preferences, choose MISC., and under Clickable Link Settings, check the box next to Enable option.

Now run your Lua script again and you should get what I am getting. Thanks for all your help :)