How To Find, Replace Spaces/Tabs Before A Pilcrow

Recently I came across an article about how to find and replace unwanted spaces and/or Tabs before a paragraph. I found this interesting because many, many people have no idea how powerful that Pilcrow (paragraph mark) is. If you copy the Pilcrow at the end of a paragraph, you are actually copying all formatting that comes with it. When I explain this to people they are always so amazed and tell me how helpful that little tidbit of information is to them. I once worked with a lawyer who told me that I had saved him hours of formatting. A lot of folks do not like to have all characters showing when they are working on a document but it is absolutely worth it if you ask me. Then you can see exactly what is going on and you are more able to fix it. But I digress – back to this very helpful article. So, how can you get rid of unwanted spaces and tabs before hitting the Enter button? This is actually quite easy to do using Find and Replace, and Wildcard.

Follow the steps below to learn how:

  1. Press CTRL + H to open Find and Replace.
  2. Click More.
  3. Select Use Wildcards.
  4. In Find What, key in: ([ ^t]{1,})(^013). There’s a space immediately after the opening square bracket and before ^t].
  5. In Replace, key in  \2.
  6. Click Find Next.
  7. If a string of spaces or tabs has been found, click Replace, then Find Next. Repeat. Do not click Replace until you are confident you will not replace a string of spaces or tabs that you need.

Below is the breakdown:

  • There are two elements in Find, both of which are enclosed in their own set of parentheses.
  • In the first element, [ ] encloses the things you would like to find – it is not a range, but single items, so there is no dash separating the space and the ^t (^t is the code for a tab marker). This means Word will search for any space and/or tab.
  • After the [ ] and before the closing parenthesis of the first element is {1,}. This tells Word to look for one or more instances of the things inside the square brackets. So, one or more spaces, and/or one or more tabs. If you wanted to restrict it, you could use {2,5} which would look for 2, 3, 4, or 5 spaces or tabs only. If you had one tab or six or more tabs/spaces, these would not be found.
  • In the second element is Word’s wildcard code for a Pilcrow (paragraph mark). In a standard find and replace, you would use ^p, but when you use wildcards, this will not work and you need to use ^013 instead.
  • In the Replace field, the \2 says to replace whatever space, tabs, and Pilcrow marks are found with only a single Pilcrow. That is, replace element 2 with itself. Because there is nothing for element 1, anything found in element 1 will be deleted.

About The Author

2 thoughts on “How To Find, Replace Spaces/Tabs Before A Pilcrow”

  1. Thank you for the pilcrow FYIs.
    I have battled my way thru Ctrl+H (Replace)… since the inception of Microsoft Office/Word. Replace\Special is my cowardice way of getting rid of those ‘invisible’ formatting marks. There are still some unique \Special characters that are not shown.
    Microsoft OneNote appears to implement “formatting” (and marks) differently than the rest of the Office Suites.

  2. Well you are certainly welcome. I personally have my Word set so that I can see all non-printable characters all the time. In that manner I can readily see what is going on with my document, but I know a lot of folks do not like to do that.
    Yes, OneNote is different in many way than Word,. In any event, I am glad that I could help you.


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top


Get great content like this delivered to your inbox!

It's free, convenient, and delivered right to your inbox! We do not spam and we will not share your address. Period!