With this approach you aren’t including the paragraph break itself in the search pattern, so you don’t have to worry about restoring it in the replacement field—you can just leave that blank. One thing to be aware of is that “EOL” in a rich text editor includes line breaks as well as paragraph breaks—which might work to your favour if you do use those.
But if you do need to distinguish, then I’d go with:
\s+(?=\n)
That won’t match line breaks, and since it is in a look-ahead clause it isn’t technically part of the replacement pattern, meaning you can go on leaving it empty.
If you are pasting text from elsewhere, esp. text copied from a web page, you might often be better off using Paste and Match Style, instead of regular Paste. This will drop out lots of formatting stuff you probably don’t want. It is often a good idea to use Zap Gremlins on internet-sourced text, too, to eliminate invisible character codes that can cause anomalous behavior.
I was using Living Writer and exported my manuscript as a .docx that I then brought into Scrivener. Now I’m trying to clean up all the artifacts and things I put in without realizing, and make clean style sheets.
Can I use one of these third party cleanups inside Scrivener? I have TextSoap if that helps.
Also, I have 3 years that are separate manuscripts. The one I already imported, I can clean up manually. For the other two, it sounds like it might be easier to do the cleanup via TextSoap in the Word doc first and then import into Scrivener. Correct?
If you have cases of multiple blank lines that you need to preserve, you can use \h+(?=\n) to trim the extra whitespace at the end of a paragraph without selecting any following empty lines. (\h only matches horizontal spaces, whereas \s will include new lines.)
That said, the RegEx search for \s+$ (or \h+$) should have worked even within a selection since it’s a broader scope than \s+(?=\n) and would’ve caught any cases of an accidental line break instead of new line. Could the focus have shifted accidentally to the wrong editor? Or if you turn on View ▸ Text Editing ▸ Show Invisibles, is there something else showing that might be interrupting the pattern?
That’s the one! It worked really well. Thank you so much. I’m going to test it on several documents first and if it’s good, I’ll run it through the whole manuscript.