I am experiencing a problem which is as follows:
My text file has contents "(((" (three parantheses)
I run a the command editor.replace("(", " ( ")
So I expect the output to have the three parentheses with a padding of one space added on each side: " ( ( ( "
However, I recieve an output of : " " (6 spaces) where the parentheses have disappeared. The same happens with ")", but I not with any other characters I've tried (including {, }, [, and ]).
Is this a bug or am I doing something wrong?
I am using Notepad++ 6.8.3 and Python Script 1.0.8.0
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This appears to be a bug. However, I noticed that the rereplace function performs this replacement correctly; if written as follows for your replacement: editor.rereplace(r"\(", r" \( ")
Note that the parentheses are special regex characters, so they must be escaped with a backslash.
Last edit: Sasumner 2015-09-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am experiencing a problem which is as follows:
My text file has contents "(((" (three parantheses)
I run a the command editor.replace("(", " ( ")
So I expect the output to have the three parentheses with a padding of one space added on each side: " ( ( ( "
However, I recieve an output of : " " (6 spaces) where the parentheses have disappeared. The same happens with ")", but I not with any other characters I've tried (including {, }, [, and ]).
Is this a bug or am I doing something wrong?
I am using Notepad++ 6.8.3 and Python Script 1.0.8.0
Thanks!
This appears to be a bug. However, I noticed that the rereplace function performs this replacement correctly; if written as follows for your replacement: editor.rereplace(r"\(", r" \( ")
Note that the parentheses are special regex characters, so they must be escaped with a backslash.
Last edit: Sasumner 2015-09-18