Count Occurrences

Count how many times a word or pattern appears.

Free occurrence counter — count how many times a word, phrase or regular expression appears in your text, with case-insensitive and whole-word options. Runs entirely in your browser, nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Can it count whole words only?

Yes — enable the whole-word option so substrings inside longer words are not counted.

This tool counts how many times a word, phrase, or pattern appears in a block of text. It is useful for checking keyword density in an article, auditing how often a term repeats in a document, tallying specific entries in a log, or verifying that a find-and-replace covered every occurrence. The count updates live as you type, with three matching modes: substring, whole-word, and regular expression.

How it works

The tool builds a global regular expression from your search term. For a literal search, any special regex characters in your input are escaped so the term is matched exactly as typed. Switching on regex uses your input as a pattern directly — without escaping. Whole-word mode wraps the term in \b word boundaries, excluding matches that occur inside longer words. Case-insensitive mode adds the i flag. The tool then counts non-overlapping matches left-to-right across your text.

Worked example

In the text “the cat sat on the mat with the hat”:

SearchModeCountWhy
thesubstring3Matches “the” in three positions
atsubstring4Matches inside “cat”, “sat”, “mat”, “hat”
atwhole word0”at” never appears as a standalone word
thewhole word3”the” is always a standalone word here
[cm]atregex2Matches “cat” and “mat”

Using regex for power counting

The regex mode opens up patterns that literal search cannot handle:

  • Count sentences ending with a question mark: \? (or \?\s for more precision).
  • Count any word starting with a capital letter: \b[A-Z][a-z]+.
  • Count lines that start with a number: ^\d (with the m multiline flag built in).
  • Count email addresses: \b[\w.-]+@[\w.-]+\.\w{2,}\b.

If your regex is invalid, the tool catches the error and shows a message rather than crashing.

Common uses

  • Keyword density check: paste an article and count how many times your target keyword appears before publishing.
  • Log triage: paste a server log and count occurrences of ERROR or a specific status code.
  • Writing audit: check how often you have used a word like “very” or “thing” before editing.
  • Find-and-replace verification: after a global replace, confirm zero occurrences of the old term remain.

Everything runs in your browser — nothing you paste is uploaded.