Regular expressions for academic editing
This is a list of regular expressions, a.k.a (in Word) wildcards, that are useful for common academic editing tasks.
These strings allow you to speed up some mechanical editing tasks. The first string of each pair should be entered in the Find field, the second in the Replace field, with use wildcards checked. Use with care, however; I don’t recommend using the find/replace all function with any of these.
More will be posted as I develop them.
Regular expressions list
Locate roman lowercase proposition variables for fast switching to italics (a typical task in editing philosophy):
Use the angle bracket markers < and > around the lower case letter p.
Replaces a bracketed year with a year preceded and followed by periods [(2000) to . 2000.].
\(([0-9]{4})\)
. \1.
The same, but where the year also has an index letter (a, b, or c).
\(([0-9]{4}[abc])\)
. \1.
Replaces hyphen in number range with en-dash.
([0-9])-([0-9])
\1^=\2
Closing quotation mark, comma, and fullstop ordering from Oxford to Chicago style – note: does not find Smart Quotes.
(“)([,.])
\2\1
Closing quotation mark, comma, and fullstop ordering from Oxford to Chicago style – does find smart quotes.
(”)([,.])
\2\1
Closing quotation mark, comma and fullstop from Chicago to Oxford style – does find smart quotes.
([,.])(”)
\2\1
Replace smart single quotes with smart double quotes (be careful with this one in case of apostrophes).
‘(*)’
“\1”
Replace smart double quotes with smart single quotes.
“(*)”
‘\1’
Change: , Vol. #, No. #, to # (#):
, Vol. ([0-9]{1,}), No. ([0-9]{1,}),
\1 (\2):
When using author-date method; in text, change comma-separated author list to semicolon separated list.
([0-9]{4}), ([! ]{1,} [0-9]{4})
\1; \2
Find a date to date number range.
([0-9]{4})^=([0-9]{4})
Find a date to date range of the form 2000-2001 (en dash) and change to 2000-01 (en-dash).
([0-9]{4}^=)[0-9]{2}([0-9])([0-9])
\1\2\3
Find a short repeated word.
()
Take out extraneous comma in text reference, author-date method. e.g., (Carling, 2000) to (Carling 2000).
, ([0-9]{4})
\1
Change semicolon separation of multiple references to comma separation.
([0-9]{4});
\1,
Locate a date in the format January 2, 1972 and change to 2 January 1972
([JFMAMJJASOND][a-z]{2,9}) ([0-9]{1,2}),
\2 \1
For Ottomanists …
(Teşrin [I]{1,2}) ([0-9]{1,2}),
Local a name of the form al-Shaykhli, Muhammad Ra’uf. and change to Shaykhli, Muhammad Ra’uf al-. [Chicago XV:18.74; actually, I disagree with this rule]
al-([A-z‘’]{3,10}), ([A-z‘’ ]{3,20}).
\1, \2 al-.
Leave a Reply