Pages: Finding & Replacing Invisible Characters

| TMO Quick Tip

Way back when dinosaurs roamed the earth, I wrote a tip about how to recognize invisible characters in Pages and what their silly symbols mean. As I mentioned, you can see which ones you’ve got by choosing View> Show Invisibles.

But here’s a pickle: What if you’re editing a document, and you find that its formatting is all messed up because of tons of those invisible characters? Is there any way to do a find and replace on them so that you don’t have to go through and delete 476 tabs, for example, that were being used to adjust margins incorrectly? I am very thankful that we can do just that. Deleting a bunch of tab characters by hand may just be my own personal hell.

So first, let’s take a look at the example text I’ve got here. 

I can tell something’s off because the left margin (indicated by my arrow) is set way over from where the text is, so I figure that whoever wrote this document added in tabs where he wasn’t supposed to. But if I go up and pick View> Show Invisibles, I can confirm that’s the case.

Yup, look at those tabs, sticking out there all…pointy. It’s not cool to try to use tabs to align the text in that way, because if you then make changes that cause the text to reflow, the document’s gonna get ugly.

The pedant in me is SO ANGRY just looking at that.

So what you’ll do here is select the invisible character you’d like to find…

…and then press Command-C (or choose Edit> Copy) to copy it. Press Command-F (or pick Edit> Find> Find) to start a search, and paste your invisible character into the “Find” box by clicking in the field and pressing Command-V (or by selecting Edit> Paste).

It looks like nothing is there (at least in the most recent version of Pages), but it’ll find your pasted tabs or your paragraph returns or what have you. 

Anyway, then you can click on the gear icon on that window and pick “Find & Replace” if you’re looking to strip out those characters or change them instead of just looking at them.

That’ll open up a new panel in that window for you to type in.

As I’ve done above, you can leave the “Replace” field blank if you want to remove every instance of the character you’ve pasted in, or you can type in something different. Afterward, you can use the arrow keys at the bottom to step through and choose which ones to replace, or if you’re feeling brave and are willing to get rid of everything, just press “Replace All.”

I’ve used this feature in so many handy ways! For example, I’ve replaced double paragraph breaks in documents (by copying two of them at once and pasting that into the “Find” box); I’ve done away with multiple tabs so that I could format a document properly; and I’ve also used it for replacing double spaces. 

Of course, you wouldn’t have to paste the two spaces into the “Find” box—you could just type ’em on in there.

The only caveat I have is that, if this doesn’t seem to be working properly for you, try selecting your character and then going up into the menus and choosing Edit> Use Selection for Find. The shortcut for that is Command-E, so you could press Command-E and then Command-F to pop right into the “Find” box with the invisible character you’ve chosen. This feature also seems a bit more persnickety with the new version of Pages than with Pages ’09, and you may not be able to get it to find and replace page or section breaks in that version, just so you know. 

I look forward to the day when Pages has as awesome of a “Find & Replace” feature as Microsoft Word, but in the meantime, at least we can strip out a few invisible characters. Ugh…it hurts my insides to have to praise Word. I think I just pulled a muscle. 

Comments

Lee Dronick

The pedant in me is SO ANGRY just looking at that.

Oh yeah!

iJack

Of course this works in other text processing as well, so long as you can show invisibles, and find/replace. I use it all the time in Bean.

Burrell Clawson

If you do much copying of text off of web pages or pdfs & particularly government sites, you really need a GREP editor which is so inexpensive (like $0) that you should not be without one.

Text Wrangler is free and its big brother BBEdit costs only $50 if I remember right.

These things can reformat a 3000 page document in a second or two.  They can do cleanup on text files in an hour that would take months for a person to do manually. 

Until you get familiar with all the abilities, it is hard to imagine how useful this can be if you have to clean up text files.

Log-in to comment