Overview
Introduction
Spotting every use of a specific word across a long document by eye is slow and unreliable, especially for a common word.
It runs entirely client-side, so nothing you paste is ever uploaded to a server.
What Is Word Highlighter?
A word highlighter that wraps every whole-word occurrence of a chosen word, matched case-insensitively, with a marker string on both sides.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How Word Highlighter Works
The target word is escaped for safe regex use and matched with word-boundary anchors on both sides, case-insensitively, and each match is wrapped in the marker string via a capturing group.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use Word Highlighter
Use it to check keyword usage in a draft, proofread for an overused word, or prepare a passage for a highlight-style export.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Letter Highlighter and Multi-Pattern Highlighter.
Features
Advantages
- Word-boundary matching avoids false positives inside longer words.
- Works with any marker string, from Markdown bold to custom brackets.
Limitations
- Highlights one target word per run; different inflections of a word need to be run separately.
Examples
Best Practices & Notes
Best Practices
- Run the tool once per distinct word or inflection you want to mark, since matching is exact per word form.
Developer Notes
The regex is built as `new RegExp(`\\b(${escaped})\\b`, "gi")` with the target word captured in group 1, so the replacement `${marker}$1${marker}` reinserts the originally-cased matched text rather than the lowercase search term.
Word Highlighter Use Cases
- Checking keyword usage or density in a draft
- Proofreading for an overused word
- Preparing text for a highlight-style export or presentation
Common Mistakes
- Expecting substrings inside longer words to be matched.
- Trying to highlight multiple unrelated words in one run.
Tips
- Use the Multi-Pattern Highlighter instead when you need to mark several different words in the same pass.