Regular Expressions to Locate Sloppy Writing

These regular expressions can be used to find weak writing, poor style, and subtle punctuation mistakes. They are not intended as a replacement for professional editing or powerful grammar and style checkers. Unfortunately, few style checkers seem to help with fiction.

It takes a lot of time to use these, so I usually wait until I'm on the final draft. They can be tedious, but I find that they help tighten my writing and improve consistency.

These patterns are designed with these assumptions:

To use one, copy the entire regular expression and paste it into your editor's search pattern with case-sensitivity enabled.

Common Problems

-ly adverbs

( |\n)[A-Za-z][a-z]+ly[^A-Za-z]

Adverbs, especially those ending in -ly, often weaken writing. Eliminate the adverb whenever possible. In many cases you should be able to find a more precise verb.

Example:

Suddenly, the thief came at me with the knife.
The thief charged at me with the knife.

I hope you agree the second sentence is better. I find that when I draft action scenes, I have a tendency to overuse adverbs like suddenly, quickly, and immediately. Removing the adverbs speeds up the action. Short quick sentences and paragraphs are better at increasing the tension than these adverbs.

Punctuation Error in Restrictive Clause

(,|---)( |\n)that( |\n)

If the clause is restrictive, then it should start with that and not be set off by commas or dashes. If it's non-restrictive, use which.

Use this one when you've got the time to weed through lots of false hits. Most grammar checkers will do a better job.

Punctuation Error in Nonrestrictive Clause

[a-z]( |\n)which( |\n)

If the clause is nonrestrictive, then is should start with which and be set off by commas or dashes. If it is restrictive, use that.

Hack Phrasing

( |\n)[A-Z][a-z]+ing(( |\n)[A-Za-z]*)*,( |\n)

Example:

Riding through Boston, Paul Revere warned of the invasion.

Sentences of this form tend to be overused in hack writing. Try rewording as two actions connected with and.

Paul Revere rode through Boston and warned of the invasion.

If the actions are truly simultaneous, you can use as.

As Paul Revere rode through Boston, he warned of the invasion.

It's not as bad to put the -ing phrase in the middle or at the end of the sentence.

Paul Revere rode through Boston, warning of the invasion.

If you do keep one of the -ing forms, make sure the subject of the sentence is also the subject of the -ing action. This sentence is grammatically incorrect:

Galloping through Boston, Paul Revere warned of the invasion.

Paul Revere didn't gallop, his horse did.

Dialogue Punctuation

(\.|\?|!)''( |\n)[A-Za-z]*( |\n)(asked|replied|said|whispered)

If a question or exclamation in dialogue is followed by an attribution, then you need a backslash after the ” to get the spacing right in TeX. If this is a sentence, then the period should be a comma.

TeX and LaTeX, unlike most WYSIWYG word processors, are pretty relaxed about how you type spaces between words and sentences. They have algorithms to determine if there should be extra space added at the end of a sentence or after a colon. Unfortunately, dialogue can trip it up. This pattern will help you find those cases as well as catch the hard-to-see problem of using a period at the end of a quotation when you should have used a comma.

``What?'' Bob said.

The question mark makes TeX think the sentence ended, and it will insert a little extra space before the dialogue tag. This pattern will point out cases where you should have typed:

``What?''\ Bob said.

Note that this regular expression uses a short list of dialogue verbs. Many editors suggest that you avoid creative verbs in dialogue tags.

Dialogue Verb Order

''( |\n)(asked|replied|said|whispered)( |\n)[A-Za-z]*

Although it's common to put the verb before the speaker, some editors insist on putting the subject before the verb. This expression will help you find cases where you used “said Bob” rather than “Bob said.”

Note that this regular expression uses a short list of dialogue verbs. Many editors suggest that you avoid creative verbs in dialogue tags.

Passive Sentences

(was|were)( |\n)[a-z]*(ing|ed)( |\n)by( |\n)

Most grammar checkers can be told to point out your passive sentences, but if yours won't, here's a regular expression to do it. Passive sentences can suck the life out of your writing. You can get by with a few, but it's easy to start overlooking them without a tool to systematically nag you about them.

They were all kissed by Sally.
Sally kissed them all.

Personal Bad Habits

I'm building this list of regular expressions as I identify sloppy things I do in my own writing. Perhaps they'll inspire you to do the same.

The Fact That

( |\n)(T|t)he( |\n)fact( |\n)that( |\n)

Replace phrase with that. If it doesn't sound right, restructure the sentence

Seem To

( |\n)(S|s)eem(s|ed|ing)?( |\n)to( |\n)

Say what is, not what seems to be. If the character viewpoint is properly established, then the reader should understand that the statement is the character's impression, so the seem to is redundant.

Who Is/Which Was

,( |\n)((who( |\n)is)|(which( |\n)was))( |\n)

At the beginning of a nonrestrictive clause, these phrases can usually be eliminated thereby transforming the clause into an appositive.

Unnecessary Thats

(knew|[a-z]*ed)( |\n)that

If the first word of this pattern is a verb and the word that is followed by a noun phrase, then you should probably eliminate that.

He noticed that Yasuda-san ditched his glass without tasting a drop.

Weak Words and Phrases

( |\n)((just)|(quite)|(really)|(very)|(in( |\n)order( |\n)to)

Kill these. They suck the energy out of your prose.

Good References

Robert J. Sawyer has a good article on word processor tricks to use while revising your work.

Lots of books and web sites cover style problems like those addressed here. The Elements of Style by Strunk and White is widely acknowledged as one of the best, but it has little that's specific to fiction. I recently found Self-Editing for Fiction Writers by Renni Browne and Dave King (ISBN: 0-06-272046-5), and it immediately became my favorite style book. It has great recommendations for fiction writers. This page was inspired in part by that book's pleas to highlight mistakes in your own writing and the realization that automation can help do that systematically.

© 2003 by Adrian McCarthy. Feel free to use these regular expressions to improve your writing. All other rights reserved. Last updated 8-MAY-2005.