Category Archives: Talking tech

Talking tech: Find and Replace

In this latest Talking tech post, Andy Coulson looks at how Find and Replace can speed up editing and styling references.

In keeping with this month’s theme of references for The Edit, I’m going to take a look at how we can use one of Word’s most powerful in-built tools – wildcard Find and Replace. References have to conform to tight formatting rules, and these lend themselves to using wildcard Find and Replace to tidy them up. This is particularly handy if you have a paper that was written with one form of referencing that needs to be changed to a different one. I’ll give a brief introduction to wildcards, then share some examples that focus on the type of issues in references and finally I’ll take a quick look at using these with Paul Beverley’s FRedit macro and PerfectIt.

Before we get cracking, a word of warning. Many academic authors use reference management software like Mendeley to produce reference lists. This software manages the references outside of Word and links to the Word document. With Mendeley you see references as form fields in the document. If you make changes, the next time the document is opened with a connection to Mendeley the reference list and links are overwritten, losing your edits. If you think this is the case, make sure you clarify how your client wants references edited.

Find and Replace can also be a blunt instrument, so use it with care. While you are refining your search, work on a copy of your text. And don’t use ‘Replace All’ unless you are very clear what you are replacing. It is safer to step through the things being found by using the ‘Replace’ or ‘Find Next’ (if you want to leave something unchanged) buttons.

Wildcards

Word’s Find and Replace feature has a number of hidden extras. If you’ve not already found these, they can be revealed by clicking the ‘More’ button under the ‘Replace with:’ field.

This opens the menu shown below and, as we are going to look at wildcards, we need to check the ‘Use wildcards’ option.

So, what is a wildcard? It is simply a character that can be used to represent anything else. A very simple example is using the character ‘?’ in a wildcard search. If you have ‘Use wildcards’ selected, put ‘r?n’ in the ‘Find what:’ field and ‘ran’ in the ‘Replace with:’ field then press ‘Replace All’, you would replace all instances of ‘ron’, ‘run’, ‘ren’, etc with ‘ran’. The ‘?’ tells Word to find any letter, so it looks for the pattern ‘r’ followed by any letter, followed by ‘n’. This does require a little thought, because what you have now also done, potentially, is turn ‘iron’ into ‘iran’, and a ‘wren’ would become a ‘wran’.

Now that example should alert you to the problems with this, but this is a very simplistic example and to do something more useful we need to dive deeper. Wildcards allow you to specify more complex patterns in the text, and as we will see in the examples below we can do some quite complex searches, often with a little trickery.

As this is a (relatively) short article I’m not going to be able to go into all of the possibilities. The best way to learn how to use these is to experiment. If you want some help, there are a number of resources available:

Examples

Let’s have a look at a couple of reference-related examples in detail so we can see how these work. For the referencing gurus out there, I am going to omit some required information from the references for clarity and play a bit fast and loose with referencing styles.

Example 1: Initials in names

Different referencing systems use different conventions for citing authors’ names in the reference list. So, you may have Hartley, J.R. (APA style), Hartley JR (Vancouver style) or even J.R. Hartley. Usually a reference list will be (largely) consistent, so it has a pattern we can find and a pattern we can replace it with. We will start with these three references:

A.N. Author. (1986). Writing for beginners (2nd ed.). Jones Books

S. Editor. (2021). Editing for fun and profit (1st ed.). MyPub Ltd

I.S.B. Nash. (2007). Cataloguing books (3rd ed.). Big Books Inc.

With Find and Replace we need to break problems down into manageable chunks, and sometimes multiple searches, that can be implemented by Find and Replace. Let’s assume we need to change author-name style in the list to Vancouver. The first issue we can tackle is the structure of the author names – setting them after the surname.

To do this we use the ‘Find what:’ string¹

^013([A-Z.]@) ([A-z]@).

What this does is:

  1. Looks for a line break: ^013 (‘^’ tells Word the number following is a character code. Note that these are for Windows and may be different on a Mac. You can find a list of these in the Wildcard Cookbook and macro book mentioned above).
  2. Looks for one or more initials: ([A-Z.]@) – the round brackets are grouping together and are important when we come to replace things; the [A-Z.] looks for capital letters or a full stop and the @ tells Word to look for one or more occurrences of these. Note that there is a space after this term, like in the text.
  3. Now looks for a capitalised word: ([A-z]@) – a combination of upper- and lower-case letters.

Now we replace the surname first and the initials after using this ‘Replace with:’ string:

^p\2 \1

This replaces the text as follows:

  1. We put the line break back in: ^p – note that we are using a different code here. ‘Why?’ you may ask. Because Word …
  2. Next we put the surname in: \2 – the \2 tells Word to use the second item in round brackets, what we found with item 3 above.
  3. Finally, we add the initials back in after a space – \1 – using the first bracketed item we found in item 2 above.

This leaves us with:

Author A.N. (1986). Writing for beginners (2nd ed.). Jones Books

Editor S. (2021). Editing for fun and profit (1st ed.). MyPub Ltd

Nash I.S.B. (2007). Cataloguing books (3rd ed.). Big Books Inc.

Now we need to remove the extra full points. We have to do that in two steps, by taking out all the relevant full points and then adding back the one after the final name.

So, removing the full points we use this ‘Find what:’ string, which simply finds one capital letter followed by one full point.

([A-Z]).

We then put the capital letter back in using this ‘Replace with:’ string:

\1

This gives us:

Author AN (1986). Writing for beginners (2nd ed.). Jones Books

Editor S (2021). Editing for fun and profit (1st ed.). MyPub Ltd

Nash ISB (2007). Cataloguing books (3rd ed.). Big Books Inc.

Now we add the final full point back in before the bracket with the year. That bracket gives us a pattern we can identify to put the full point in the right place. So, we use the ‘Find what:’ string:

([A-Z]) \(

As before, the round brackets contain a string to find one capital letter; this is followed by a space and finally by \(. ‘What is that?’ you may ask. Well, we use brackets to create a sequence in the search string that we can return to later, so in wildcard searches round brackets (and a number of other symbols) work as commands. In order to refer to those symbols we need to escape it, which means adding a backslash in front, so \( finds an opening round bracket. We can then use the following ‘Replace with:’ string to add the full point.

\1. ^40

As before \1. adds the initial back with the full point and ^40 puts an open bracket back. Again, note the different way that replace refers to the character, but that’s just the way it works I’m afraid. This then gives us:

Author AN. (1986). Writing for beginners (2nd ed.). Jones Books

Editor S. (2021). Editing for fun and profit (1st ed.). MyPub Ltd

Nash ISB. (2007). Cataloguing books (3rd ed.). Big Books Inc.

Example 2: Adding styling

I realise this is not proper Vancouver referencing, but I want to show you how we can add styling using wildcards. In this example we will apply italics to the book titles. As before, we need a pattern to recognise which part is the book title. In this case we have the end of the year ‘). ’ and the start of the edition ‘ (’. However, in order to find the title we have to find more text, the two brackets before and after, which we don’t want in italics. This means we need to be a bit cunning!

To do this we use this ‘Find what:’ string:

(\). )([A-z .]@)(\([0-9])

  1. (\). ) finds a closing bracket \), followed by a period and a space and we want to keep those, so we group them.
  2. ([A-z .]@) looks for a mix of upper- and lower-case letters, spaces and full stops – our surname and initials.
  3. (\([0-9]) looks for an open bracket \( plus a number – the characters at the start of the edition.

If we then replace this with:

\1%%\2%%\3

we put %% before and after the characters of the title that we want to italicise:

Author AN. (1986). %%Writing for beginners %%(2nd ed.). Jones Books

Editor S. (2021). %%Editing for fun and profit %%(1st ed.). MyPub Ltd

Nash ISB. (2007). %%Cataloguing books %%(3rd ed.). Big Books Inc.

We now have the title clearly marked, so can then style that. We search for the modified title with %% before and after.

%%([A-z .]@)%%

We then replace that with just the title text, which we have put in round brackets, so \1 goes in the ‘Replace what:’ field. Before we replace this, we need to tell Word to italicise this text. If you tap on the ‘More’ button in the bottom left you will see a ‘Format’ button. Pressing on this pops up the menu shown below. If you select ‘Font’ the font dialogue box pops up and you can select ‘Italic’. You will also see ‘Font: Italic’ appears under the ‘Replace with:’ field.

Running that Find and Replace gives us our final list:

Author AN. (1986). Writing for beginners (2nd ed.). Jones Books

Editor S. (2021). Editing for fun and profit (1st ed.). MyPub Ltd

Nash ISB. (2007). Cataloguing books (3rd ed.). Big Books Inc.

Integrating with Macros and PerfectIt

Wildcard Find and Replace searches like this are real timesavers, but there’s no obvious way of saving these and using them again and again. There is a short history for both the ‘Find what:’ and ‘Replace with:’ fields if you click the down arrow at the right of each, but I don’t find this particularly helpful.

Both Paul Beverley’s FRedit macro and PerfectIt support using wildcards, so offer a way to reuse multiple Find and Replace searches. As the point of using things like macros and wildcards is to save you time sometimes the investment of time to set up those searches in a macro or PerfectIt may not add up compared to just running the searches. For example, I do some work on papers for academic journals that are about 6,000 words long. I get material for multiple different journals, so it is quicker for me to just use a few Find and Replace searches rather than setting up, say, FRedit. However, a book or multiple papers for the same journal would change that, and setting up FRedit or PerfectIt would then be worthwhile. Having said that, writing this has convinced me to create a file of Find and Replace searches I can refer back to. I will probably format this as a FRedit list so I can use these with that macro.

PerfectIt allows you to perform wildcard searches in the ‘Wildcard’ tab. This lets you use all the features of wildcards in Word Find and Replace and adds a couple of neat features. The first of these is that you can add an instruction or prompt that explains what the search is doing, because, as we saw above, patterns can crop up in unexpected places. The second of these is that you can add exceptions. PerfectIt’s manual page uses the example of apostrophes being added to numbers followed by ‘s’, so ‘we have 3s, 4s and 5s chosen’ is correct. However, if we talk about ‘Page 4’s content’ we need the apostrophe. We can make numbers after the word ‘Page’ an exception.

FRedit is a scripted version of Find and Replace, so runs multiple Find and Replace searches from a list. It uses all the forms in Word Find and Replace, but has a few little tweaks you need to use in the file of searches we set up. FRedit doesn’t present us with the dialogue boxes that Word Find and Replace does. So in the file we use ‘|’ to separate the ‘Find what:’ and ‘Replace with:’ terms on a line and add ‘~’ at the start of the line if we are using wildcards. We can also add formatting easily. I sometimes use FRedit to quickly highlight things so I can then take my time on a read-through to check the context. For example, if you have an app called Balance it needs capitalising, but if you also talk about keeping your balance it doesn’t, so you have a mix, but the context will determine which you use.

Hopefully this has given you some ideas and encouraged you to go and experiment. I can honestly say learning how to use wildcards and Find and Replace efficiently has helped speed up my editing enormously. Combining these with FRedit or PerfectIt speeds things up even more where you have longer pieces or house styles you use regularly.


1 Paul Beverley has flagged that while ‘[A-z]@’ will find any letter it does not pick up on accented letters. A better solution is ‘[A-Za-z]@’.

About Andy Coulson

Andy Coulson is a reformed engineer and primary teacher, and a Professional Member of CIEP. He is a copyeditor and proofreader specialising In STEM subjects and odd formats like LaTeX.

 

 

About the CIEP

The Chartered Institute of Editing and Proofreading (CIEP) is a non-profit body promoting excellence in English language editing. We set and demonstrate editorial standards, and we are a community, training hub and support network for editorial professionals – the people who work to make text accurate, clear and fit for purpose.

Find out more about:

 

Photo credits: magnifying glass by towfiqu barbhuiya on Canva, joker by Roy_Inove on Pixabay.

Posted by Harriet Power, CIEP information commissioning editor.

The views expressed here do not necessarily reflect those of the CIEP.

Talking tech: Automating style sheets

In this Talking tech column, Andy Coulson considers the options available for automating style sheets.

The theme of February’s member newsletter, The Edit, is editorial judgement and, as I’m sure you’ll have noticed, this is something computers are not good at! While the latest artificial intelligence systems are great at applying rules consistently and often ruthlessly, they are not good at making those subtle judgements that convey nuanced meaning or reflect an author’s voice. So how can technology help us?

Our main tool for recording our professional editorial judgement is the style sheet, whether that is something created specifically for a job, or by making additions to a style sheet from a client. We have a number of tools that we can use to support our creation of style sheets.

Exploiting your computer’s strengths

So, if our computer is not good at judgement, what is it good for? Computers are very good at following rules and recognising consistency. We can make good use of that to spot patterns in the materials we are working on and inform decisions that we can then record in a style sheet. We can also use these to help us see where exceptions are, as these can be important too (for example judgment in British English refers to a legal judgment; judgement is what you are applying in choosing the right spelling of it!).

One thing I’m not going to look at is the Editor tool in Word itself. In theory this should be able to do a lot of the things I’m going to talk about, but I’m afraid I just can’t get on with it. I find that configuring it is too fiddly when you are working on material where the style can change from job to job. I’m going to look at PerfectIt and Paul Beverley’s macros, as both of these will ultimately allow you to do things quicker and, to my mind, more accurately as editors and proofreaders.

PerfectIt

PerfectIt is a proofreading and consistency add-in for Word. Many of us use it to speed up our workflow and it can be used to help with identifying style sheet issues with the text you are editing. When you run PerfectIt, the content of the document is compared against a number of tests. You can use the results to identify what needs to be included in the style sheet.

Let’s have a look at an example. I’ve got a journal article that the client needs to be in US English and they prefer to use the Merriam-Webster dictionary for spelling. I’ve selected the basic ‘US Spelling’ style in PerfectIt, but you may be able to find (or create) a more comprehensive style sheet that is more applicable. If you regularly use PerfectIt it would be worth keeping an eye on the ‘PerfectIt Users’ group on Facebook, as they are developing a collaborative style sheet project.

Here one of the tests is checking the consistency of hyphenation. As we can see, the author has used ‘photogenerated’ five times and ‘photo-generated’ once. This flags that we need to check and make a judgement. This isn’t in Merriam-Webster, but ‘photoactivated’ and ‘photometered’ are, so I feel comfortable going with the single word and can justify the choice, and that goes on the style sheet.

Hopefully you can see how you would go through and build your style sheet in this way, using the computer’s strength around consistency checking.

Macros

I’ve written before about Paul Beverley’s macros (archivepub.co.uk/index.html) – they are a brilliant resource and Paul contributes so much to the community with these. I’m not going to give detailed instructions about using the macros highlighted as Paul’s book and videos do that really well. I’ll concentrate on an overview of the tools you can use to create a style sheet at the start of a job. Paul also lists his editing process in the book or in his Macro-aided book editing video, and this includes using the macros to identify potential style sheet items.

Overall, I think I prefer this approach to using PerfectIt, although I do use both tools for different jobs. I work on a lot of school textbooks and I find that the macros are able to do a lot more tidying up of formatting than PerfectIt, so they suit my workflow better.

Two key macros to start with are DocAlyse and HyphenAlyse. DocAlyse is a ‘Swiss army knife’ tool that looks at a range of features of the document, such as how numbers appear, approximate US and UK (and -is/-iz) spelling counts, Oxford (serial) comma counts and so on. All of these give you a broad view of your author’s preferences. Paul also has the UKUScount and IZIScount macros that provide more accurate counts if the language and spelling choices are unclear, and SerialCommaAlyse that counts serial comma use more accurately. You can then apply your judgement to the results and record those in the style sheet.

Next up is HyphenAlyse, which looks at hyphen and en dash usage in the document and creates a list of hyphenated phrases along with their open equivalents as well as commonly hyphenated prefixes (for example, net-zero and net zero or coordinate and co-ordinate). The output gives you counts of each usage, helping you to narrow down your choice and again build the style sheet.

SpellAlyse can then be used to make a list of potential spelling issues – this will help identify spellings specific to the topic or flag words that need checking. SpellAlyse has a number of other tricks up its sleeve and Paul’s book explains these. In addition, ProperNounAlyse and CapitAlyse try to identify proper nouns and capitalised words, again helping to inform the choices you make, which can be added to the style sheet.

Unlike PerfectIt you don’t see these in context, but Paul has a number of highlighting macros that can help with this. Because all of these macros produce outputs in Word files it is quick to add things to a style sheet. It is also fairly easy to create a file to use with Paul’s FRedit macro, which performs a scripted find and replace on your file. As well as building a list of corrections to apply to the files you could also use FRedit to highlight a range of issues in the document so you can make decisions about them.

Macros do take a little getting into, but the time savings that they can provide make this time well spent. Over a few jobs you will be able to identify a set of macros that help you create an efficient process, and you will be able to allocate keystrokes to them and create backups.

Hopefully I’ve convinced you to invest a bit of time in learning these tools, as in the longer term they can be real time savers. As ever, back up your customised PerfectIt style sheets (.pft files) and FRedit script files as you can often use and adapt them. There are also lovely people out there sharing other resources like this that they have created. Among the places you can find these are the CIEP forums, where there’s a dedicated ‘Macros’ forum; and the ‘PerfectItUsers’ group on Facebook.

About Andy Coulson

Andy Coulson is a reformed engineer and primary teacher, and a Professional Member of CIEP. He is a copyeditor and proofreader specialising In STEM subjects and odd formats like LaTeX.

 

 

About the CIEP

The Chartered Institute of Editing and Proofreading (CIEP) is a non-profit body promoting excellence in English language editing. We set and demonstrate editorial standards, and we are a community, training hub and support network for editorial professionals – the people who work to make text accurate, clear and fit for purpose.

Find out more about:

 

Photo credit: laptop by Skitterphoto on Pexels.

Posted by Harriet Power, CIEP information commissioning editor.

The views expressed here do not necessarily reflect those of the CIEP.