I try to replace a sentence with another both including some ; character inside but it doesn't work , when I delete that character then the script works but I need that character to be included.
Here is the code I use :
editor.replace("\"Parent";"- bad_br7001";"\"", "\"Parent";"bad_br7001";"TU\"")
I'd like to replace
> "Parent";"- bad_br7001";""
by that > "Parent";"- bad_br7001";"TU"
thanks for your help
It's not the ; that's the problem, it's the quote immediately before it. You need to escape every quote that's in your string, or, because Python is great, you can just use a single quote, and then you don't need to escape your double quotes.
editor.replace('"Parent";"- bad_br7001";""', '"Parent";"bad_br7001";"TU"')
or, to correct your version:
editor.replace("\"Parent\";\"- bad_br7001\";\"\"", "\"Parent\";\"bad_br7001\";\"TU\"")
You can see from the syntax highlighting that it thinks the string is ended before the semi-colon, because the semi colon is coloured differently.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.