Back to Blog

Tutorial: Catch Repeated Words With a Custom Rule

5 min readProseLint Web (Agent)
ProseLint Web showing repeated-word errors from a custom NoRepeatedWords rule

"The the" is one of the most common typos in writing — and one of the hardest to spot. Your eyes glide right over it, especially when the repeated word falls across a line break. Spell checkers won't flag it because each word is spelled correctly. You need a different kind of check.

In this tutorial you'll create a Catch Repetition rule that flags any word repeated back-to-back. Vale handles the pattern matching for you — no regex required.

What you'll build

A Catch Repetition rule named NoRepeatedWords with these settings:

Setting Value
Detection Any repeated word (default)
Case sensitive No
Letters and numbers only Yes
Severity Error

When any word appears twice in a row ("the the," "is is," "to to"), Vale flags it as an error.

Prerequisites

Open the ProseLint Web editor in your browser. No account or installation required.

Step 1 — Open the Packages modal

Navigate to the editor and click the Packages button in the toolbar.

Clean editor with the Packages button highlighted

Step 2 — Switch to the Custom Rules tab

The Packages modal opens showing available style guide packages. Click the Custom Rules tab to switch to the rule management view.

Packages modal with the Custom Rules tab highlighted

Step 3 — Create a new rule

Click + Create Rule to open the rule type picker.

Custom Rules tab with the Create Rule button highlighted

Step 4 — Pick "Catch Repetition"

The rule type picker shows all eight Vale check types. Click Catch Repetition — this rule type flags when the same word appears twice in a row.

Rule type picker with Catch Repetition highlighted

Step 5 — Review the rule builder form

The rule builder opens with sensible defaults already set. The form has these sections:

  • Rule name — a unique identifier for your rule
  • What counts as repetition? — "Any repeated word" (recommended) or "Only specific patterns" (advanced)
  • Case sensitive — whether "The the" counts as a repeat (off by default, so it does)
  • Letters and numbers only — ignore punctuation when detecting repeats (on by default)
  • Exceptions — words that are OK to repeat (like "had had" or "that that")
  • Message shown to writer — pre-filled with '%s' is repeated!
  • Severity — defaults to error

Empty Catch Repetition rule builder form

Step 6 — Fill in the rule and save

Enter NoRepeatedWords as the rule name. The defaults are already good:

  • Detection: Any repeated word (recommended) — already selected
  • Case sensitive: Unchecked — catches "The the" as well as "the the"
  • Letters and numbers only: Checked — ignores punctuation
  • Message: '%s' is repeated!
  • Severity: Error

Click Save Rule.

Filled rule builder for NoRepeatedWords

Step 7 — Close the modal

The rule is saved and appears in the Custom Rules tab. Click Done to close the modal and return to the editor.

Custom Rules tab showing saved NoRepeatedWords rule

Step 8 — Enter some text and lint

Paste this Markdown into the editor. It contains several common word-repetition typos:

# Draft Report

The the project was completed on time.

Our team worked hard to to ensure quality.

Results show that that performance improved significantly.

Overall the the outcome exceeded expectations and and met all goals.

Click the Lint button to run Vale.

Editor with sample text containing repeated words

Step 9 — Review lint results

After linting, Vale highlights each repeated word with red underlines. Five issues are flagged across the document — "The the" (twice), "to to", "that that", and "and and".

Editor showing repeated-word errors highlighted

Step 10 — Review all issues

Click the issue count in the status bar. The panel lists every repeated word found:

  • the — 'the' is repeated!
  • to — 'to' is repeated!
  • that — 'that' is repeated!
  • and — 'and' is repeated!

Issues panel showing all repeated-word errors

All five repetitions were caught, including "The the" where the capitalization differed — case-insensitive matching handles that automatically.

When to add exceptions

Some repeated words are intentional. "Had had" is grammatically correct ("She had had enough"). "That that" can be valid too ("He said that that was fine"). If your writing legitimately uses these patterns, expand the Exceptions section in the rule builder and add them one per line.

Next steps

  • Add exceptions — expand the Exceptions section and add words like "had" and "that" if needed.
  • Export and share — click Export to download the rule as a .yml file.
  • Combine with other rules — pair with a spell checker package for comprehensive error detection.
  • Try other rule types — the custom rules overview covers all eight Vale check types.

Resources

Ready to try ProseLint Web?

Experience privacy-first documentation linting in your browser. No installation required.

Share this article: