Posted 15 years ago
by Joachim Schwieren
Hi,
I' trying to use the search & replace feature of SyntaxEditor to implement an intelligent "quote-in"/"quote-out" functionality: e.g.
If the text is "this is a sample" it shall become \" this is a sample \".
This is quite simple, but if the text is "This is a \"good\" example" it shall become \"This is a "\good\" example\".
So the idea is to prevent a double quote.
Here is my approach:Unfortunately the negative look behind does not work (Exception text: "Op code not implemented: 0"). In contrast to that, a positive look ahead works well but does not help in the scenario...
Why doesn't this work?
Thanks,
Joe
[Modified at 08/03/2009 10:19 AM]
I' trying to use the search & replace feature of SyntaxEditor to implement an intelligent "quote-in"/"quote-out" functionality: e.g.
If the text is "this is a sample" it shall become \" this is a sample \".
This is quite simple, but if the text is "This is a \"good\" example" it shall become \"This is a "\good\" example\".
So the idea is to prevent a double quote.
Here is my approach:
FindReplaceOptions opts = new FindReplaceOptions();
opts.FindText = "(?<!\\\\)\\\"";
opts.ReplaceText = "\\\"";
opts.SearchType = FindReplaceSearchType.RegularExpression;
Why doesn't this work?
Thanks,
Joe
[Modified at 08/03/2009 10:19 AM]