Minor Find and Replace bug

I am using the code <$sn> to add numbers to sections to my document. I noticed that following some late night copy and pasting that I had missed the leading “<” from some paragraphs. I selected the group of Scrivenings and displayed them (edit scrivenings) next I selected all the text and went to Edit Find and ticked selected text and whole word and searched for "$sn> and replaced with “<$sn>” and used the replace all option. This replaced all the codes even those with the leading angle “<” leaving them as “<<$sn>”. The odd thing is that the correction search / replace all of “<<$sn>” to “<$sn>” worked fine.


Well, <$sn> includes the string $sn>, so that would have been replaced by <$sn> as instructed … the new < is the inner one. When you searched for <<$sn> it would find all those and replace them as instructed.



I assume you were expecting it to ignore the “$sn>” in “<$sn>” because it is not a “whole word”.

I think according to the algorithm it will be defined as a whole word, as words do not necessarily require whitespace around them, but also certain punctuation marks.

If you replace whole words such as “big” with “small”, it will replace a “big” within as well (i.e. treating it as a whole word).

Does that make sense?


Matt, Yes I was expecting whole word to cause <$sn> to be ignored. I understand your explanation. Does the function make sense ? hmmmm…



Yes, this is not a bug but expected behaviour. Words do not include punctuation.