I need to replace a target at the beginning of lines with something else. Without wildcards, I can say to replace "^pTarget" with "^pReplacement". With wildcards enabled, I use replace "^13Target" with "^13Replacement". The replacement is successful except that the paragraph is now merged with the previous one in a strange way:
The end-paragraph mark is still in place and the paragraph begins on a new line, but
Triple clicking to select paragraph selects both the changed paragraph and the one above
In a macro, starting in the paragraph above and extending the selection to the end of paragraph causes both paragraphs to be selected.
Inter-paragraph spacing disappears between the changed paragraph and the one above.
In essence, the paragraph boundary has been removed although the end-paragraph mark is still shown.
To duplicate this problem, make a new document
Line 1
Line 2
Line 3
(separate paragraphs). Find and replace (with wildcards on) "^13" with "^13". If your result is the same as mine, you will see the problems listed above.
I can work around this in the usual way of replacing ^p with something else first, e.g. "^p" = "$", then "$target" = "$replacement", but I'm curious about what's going on.
(This is using Word 2007 on Windows 7)
I don't know Word XML, but the XML output seems to correspond with the above. Replacing ^13 with ^13 moves the paragraphs together in almost the same way as replacing end-paragraph with end-line (^p = ^l). Here is the relevant XML of the original "Line 1, Line 2, Line 3" in separate paragraphs:
<w:p w:rsidR="00BB3032" w:rsidRDefault="00027252">
<w:r><w:t>Line 1</w:t></w:r>
</w:p>
<w:p w:rsidR="00027252" w:rsidRDefault="00027252">
<w:r><w:t>Line 2</w:t></w:r>
</w:p>
<w:p w:rsidR="00027252" w:rsidRDefault="00027252">
<w:r><w:t>Line 3</w:t></w:r>
</w:p>
Now after replacing ^13 with ^13:
<w:p w:rsidR="00027252" w:rsidRDefault="00027252">
<w:r><w:t>Line 1</w:t></w:r>
<w:r w:rsidR="00C57863"><w:cr/></w:r>
<w:r><w:t>Line 2</w:t></w:r>
<w:r w:rsidR="00C57863"><w:cr/></w:r>
<w:r><w:t>Line 3</w:t></w:r>
<w:r w:rsidR="00C57863"><w:cr/></w:r>
</w:p>
Now original after replacement of ^p with ^l (convert end-paragraph to end-line)
<w:p w:rsidR="00027252" w:rsidRDefault="00027252">
<w:r><w:t>Line 1</w:t></w:r>
<w:r w:rsidR="00AC7B51"><w:br/></w:r>
<w:r><w:t>Line 2</w:t></w:r>
<w:r w:rsidR="00AC7B51"><w:br/></w:r>
<w:r><w:t>Line 3</w:t></w:r>
<w:r w:rsidR="00AC7B51"><w:br/></w:r>
</w:p>