Regular Expressions Will Turbo Boost Your Find & Replace

Find and Replace is both an essential tool in the editor’s toolbox and the source of ruination. (Into every editor’s life, a hilariously bad Replace All will fall.) You can use “regular expressions” to turbo boost your F&R!

No need to learn the special codes for regular expressions: use this list.

The simplest way to think of “regular expressions” (regex) is as that list of options for types of content we find in that the drop-down menu in the Find field (see figure). The list gives you an easy selection of regex special codes, using descriptors. Click on one of those and the code for the regex appears in the field—^p for Paragraph Mark, for example.

These regex are particularly useful for finding section breaks, footnote markers, and graphics that have jumped out of sight. They also remedy multiple paragraph breaks used for spacing.

These special codes are available for use in the Replace field as well. The one I find most useful there, however, is not one of the options in the list. It’s ^&, which means, essentially, “what’s in the Find field.” Using ^& in the Replace field saves me from retyping (or mistyping) the entire search criteria just to change formatting (e.g., to apply or remove highlighting), among other uses.

Troubleshooting

book cover cropped to banner size
This tip comes from page 46 of the book. Find more on Find and Replace starting on page 45.

Regex sometimes malfunction when Use Wildcards is selected. Learn more about that in the book.

Regex are not wildcards. Next week, we’ll look at some wildcards and how they can add nitro to this turbo boost.



Got a gnarly Word problem? Submit your problem and we’ll try to answer it in the Q&A thread.



Learn with us! Join a course today.

© This blog and all materials in it are copyright Adrienne Montgomerie on the date of publication. All rights reserved. No portion may be stored or distributed without express written permission. Asking is easy!

Magnifying glass image by Peggy und Marco Lachmann-Anke from Pixabay.

Leave a Reply