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!
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 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.
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 new Q&A thread.
Never miss a Word-Wrangling Wednesday tip. Sign up here to get them by email.
By practicing one tip each week, you can invest 13 hours this year into professional development. To search the blog, use the orange bar right above this.
© 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!