• Extra CRLF In Replace?

    • This topic has 4 replies, 4 voices, and was last updated 15 years ago.
    Author
    Topic
    #469594

    For Find and Replace, it always puts an extra character after the last line. For example, using the three lines below:

    Line1¶
    Line2¶
    Line3¶

    The Find/Replace values of Find: ^13 and Replace with *^13 always inserts an extra CRLF after the last line:

    Line1*¶
    Line2*¶
    Line3*¶

    How can I not have the extra character add?

    Viewing 3 reply threads
    Author
    Replies
    • #1228746

      Try a wildcard Find/Replace with:
      Find = ([!^13]{1,})
      Replace = 1*

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1228930

      Excellent. Works like a charm.

      Out of curiosity though, why does the original search add an extra line only to the last line?

    • #1228935

      Probably because all documents must finish with a paragraph mark and for a moment in time your search and replace removes this paragraph mark and Word stops the document corrupting by adding one in for you. Note that your search and replace finds paragraph marks are replaces them with pseudo-paragraph marks. You should have replaced the ^13 with a ^p rather than ^13. Hint: Check your paragraph count before and after replacing with ^13.

      The better question would be why does Macropod’s solution work. He very cunningly searches for everything except a ^13 and adds a star AFTER it. This avoids actually replacing the paragraph marks at all. This is also very clever because ^13 is actually different to a ^p and you can’t search for ^p when wildcards is turned on (but you can use them in the replace box.

    • #1228938

      Macropod’s code replaces everything in the line but the ^13. So it doesn’t really change the ^p to the pseudo paragraph mark (^13). That’s why it works.

      Pam

    Viewing 3 reply threads
    Reply To: Extra CRLF In Replace?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: