Word Wildcard Examples: Real Strings for Real Documents
We know learning what each wildcard symbol does is one thing. But knowing what to do with them on a Tuesday afternoon with a 60,000-word manuscript open is a whole other daunting prospect.
Trying to spot the eleventeen ways your author has written a court citation are all variations on one pattern, and that the pattern is describable. Once you see that, trust us, the string is the easy part.
Here are a set of strings that do real jobs. Some are general enough for any document and others are specific to a field. All of them illustrate the same underlying habit, which is a key learning point to remember throughout: use a wildcard search wherever there is a regular pattern between the range of things you want to find, as well as between the things you are searching for and the things you are replacing them with.
General consistency fixes
Putting full stops into initialisms
Find: <([A-Z])([A-Z])([A-Z])>
Replace: \1.\2.\3.
Turns NCO, RHS, and BBC into N.C.O., R.H.S. and B.B.C. The catch is that you need to know how long your initialisms are and run one search per length, because parentheses can't be nested.
Standardising em and en dashes
Find: ([A-Za-z]) [—–] ([A-Za-z])
Replace: \1—\2
There are four possible house conventions for dashes between words, em or en, spaced or unspaced, and no doubt large parts of your life have disappeared into reconciling them. This one converts spaced dashes to unspaced em dashes. You can also write ^= for an en dash and ^+ for an em dash if the two are hard to tell apart on screen, which they are.
Reformatting long-form dates
Find: <([0-9]{1,2})[dhnrst]{2} ([ADFJMNOS][abceghilmnoprstuvy]{2,8}) ([0-9]{4})
Replace: \2 \1, \3
Changes 20th July 1969 to July 20, 1969, helping you swap day and month, dropping the ordinal, and inserting the comma, all in one pass. The month inventory looks odd but only contains letters that actually start or appear in month names.
Medical writing
Spacing units of measurement
Find: ([0-9.]@)([mμn]g)
Replace: \1^s\2
The AMA Manual of Style wants a space between a quantity and its unit. This handles milligrams, micrograms, and nanograms at once, and inserts a non-breaking space so the figure never splits across a line.
Degree symbols, but only for temperature
Find: ([0-9.]@)(°[CF])>
Replace: \1 \2
Temperatures take a space before the degree symbol; angles don't. Since a temperature is always followed by C or F, wildcards can enforce the distinction that a plain find-and-replace can't see. Ordinarily this may be a simple find and replace as there may only be a couple at most in a document. In regulatory docs, scientific publications, medical education documents etc, there could be hundreds of instances.
Numbering patients consistently
Find: [Pp](atient)[ ^s]([0-9]@)
Replace: P\1^s\2
Ensuring patient anonymity and accuracy is crucial and often follows a specific format. This string would capture the most common way: capital P, non-breaking space, in one sweep. Instances that are already correct get replaced with themselves, which does no harm at all so, you can press Replace All without hesitating. Swap in day, week or month and you have the same fix for every time reference in a trial report.
Technical writing
The micro problem
Find: <([0-9.,]@)[ ^s]u([ACFLVWgsΩ])>
Replace: \1^sμ\2
Writers routinely type u where they mean μ. You obviously can't replace every u in a document, but you can replace every u that sits between a number and a unit symbol. This catches microamps, microlitres, micrograms, microseconds, and microohms in one go.
Spacing mathematical operators
Find: ([! ^s])([+−±×÷=≈≡≠<>≤≥])([! ^s])
Replace: \1^s\2^s\3
The clever part is [! ^s] - "not a space". Looking for a digit either side would fall apart the moment you hit algebra or π.
Proposal writing
Currency codes before the amount
Find: <([0-9,.]@)([ ^s])([A-Z]{3})>
Replace: \3\2\1
Turns 400 EUR into EUR 400. Three expressions, recalled in reverse. Rearrange to taste if your house style puts the code afterwards.
Legal writing
Court of Appeals circuits
Find: <([23])[dnr]{1,2}[ ^s]C[ir]{1,2}([!.])
Replace: \1d^sCir.\2
2nd Cir, 2d Cr, 2nd Ci, there are at least eleven ways to get the Second Circuit wrong, and Bluebook wants 2d Cir. This string catches the lot and picks up the Third Circuit while it's there.
Academic writing
Adding the word "marks" back into an exam paper
Find: \[([0-9]@)\]
Replace: [\1 marks]
Note the escaped square brackets, which are the real ones in the text, sitting outside the wildcard square brackets that mean "any digit".
Reordering the first author in a reference list
Find: ^13([A-Z].[A-Z]. )([A-Za-z’\- ]{1,})
Replace: ^p\2, \1
This is the one that makes people sit up. The first author in every reference, and only the first, immediately follows a paragraph mark. Use that, and you can flip C.S. Ryder to Ryder, C.S. throughout a bibliography without touching the co-authors. The surname inventory allows for double-barrelled names, apostrophes and spaces.
Adapt, don't copy
Every one of these will need a nudge for your own documents, and every one deserves a cautious Find before a confident Replace All. But they show the shape of the thing. Once you start seeing your work as a set of patterns rather than a list of individual corrections, the strings write themselves.
Get the full guide, free
Brave New Word is our free ebook on Wildcard Find & Replace in Word and PerfectIt, by our in-house linguist, Chris Ryder. It has dozens more detailed worked examples across medical, technical, proposal, legal, and academic writing, a full index of ready-made strings for dates, times, currency, computing, and punctuation, chapters on what to do when a string goes wrong, and two on building wildcard checks into PerfectIt. There's also a printable cheat sheet at the back.