How to Use “Insert Pattern” in TextEdit to Clean Up Text

If you’ve ever had a bunch of text with extraneous characters—tabs everywhere, say, or tons of repeated paragraph breaks—then you’ve gotta check out TextEdit’s user-friendly way of cleaning stuff like that up. This feature’ll even let you search for patterns, so if you need to find “[tab][paragraph break][asterisk][digit],” you can do so. I know you won’t believe this, but it’s true—this tip came about because I had to use TextEdit to find something very similar to the above in a 500-page file. Yes, my day job is weird. But often very fun.

To take advantage of this, first you’ll open TextEdit, of course. Then you’ll paste in the text you’d like to clean up; here’s my example document below, which contains a ton of tabs that I don’t want in there.

TextEdit Document with Tabs that need to be found and removed

I’ve been working for TMO for like 87 years now. You’d think I’d get better at writing up stuff for my screenshots.

Anyhow, once your own file is ready for cleanup, you can press Command-F to open the “Find” toolbar, or you could instead choose Edit > Find > Find from the menu bar.

Add the Find bar to TextEdit's document window from the Edit Menu

Then you’ll see the aforementioned toolbar appear, like so:

Find Toolbar in a TextEdit document window

See that magnifying glass with the arrow I’ve called out? If you click that, you’ll get a magical little drop-down menu:

Drop-Down within Find Toolbar showing Insert Patter option

From that, you could turn on “Ignore Case,” which’ll mean that TextEdit will look for both “Apple” and “apple” at the same time, or you could choose to look for items starting with your search term, for example. But the highlighted option—“Insert Pattern”—is what I’m gonna talk about for this tip, so pick that. Here’s what you’ll see afterward:

Drop-Down from Find Toolbar showing Insert Patter options

Ah, I love that so much. To strip out those awful tabs shown in my first screenshot above, I’ll just pick “Tab” from this menu, and TextEdit will search the document for that.

TextEdit Found Tab Characters using the Insert Pattern option for a search

If I then click the “Replace” checkbox…

Find toolbar Replace Checkbox lets you search and replace content in TextEdit documents

…I can leave the “Replace” field (outlined in green above) blank, which is the equivalent of saying “find all the tabs, and then replace them with nothing.” When I do that and click the “All” button, everything gets fixed! Check it out:

Replaced All Tabs

If you’d prefer the more careful way, you could click “Replace” instead of “All.” That’ll step through every found item and fix them one by one.

Finally, an especially neat feature of this is that you can use it to find patterns of characters instead of one at a time. Which is guess is sort of implied in its whole “Insert Pattern” name, right? Yeah. But anyway, if you visit that magnifying glass menu and pick “Insert Pattern” multiple times to add in additional characters, you could look for complicated patterns and potentially replace them. In my example below, I’ve chosen to search for any number followed by a tab and then a paragraph break:

Add more Insert Pattern options for Complicated Pattern Searching

So as I mentioned at the beginning, you could use this to find really intricate stuff, including even words typed in between the available characters:

Complicated Pattern Searching in TextEdit lets you find and replace or remove content in documents

Ah, the good old “[tab][paragraph break] apple [page break][asterisk] 76” search. I use that all the time.

I think it’s a great idea to play with this and get familiar with how it works! It’s awesome how much power is built into such a tiny little free program. I love TextEdit anyway (I write all of my tips with it!), but this just makes it even better.

8 thoughts on “How to Use “Insert Pattern” in TextEdit to Clean Up Text

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WIN an iPhone 16 Pro Max!