Substring Occurrence Counter
Count a word or phrase in text with literal, whole-word, and regex modes, with line and column for every match.
Text to search
Occurrences
0 matches · 12 lines · 255 charsEnter text and a term to count
Results update as you type. Nothing leaves your browser.
Details
Counts a chosen word or phrase in text using literal, ignore-case, whole-word, or regex matching. Every match gets a 1-based line and code-point column with a short context snippet; the report also shows per-line counts, first and last positions, and density. Overlapping literal matches, Unicode NFC normalization, and regex patterns are supported. Counting runs entirely in your browser; nothing is uploaded.
More examples
Count log errors
2026-11-27 09:12:01 ERROR timeout calling billing
2026-11-27 09:12:02 Warning retry scheduled
2026-11-27 09:12:03 Error timeout resolved
Find: error · Mode: Ignore caseIgnore-case mode finds both ERROR and Error and reports the line and column of each hit.
Whole word versus substring
cat category tomcat cat
Find: cat · Mode: Whole wordWhole-word mode counts only the two standalone cat tokens. Literal mode also counts the ones inside category and tomcat.
Overlapping matches
aaaa
Find: aa · Overlapping: onWith overlapping enabled the scan steps one character at a time, so aaaa contains three aa hits instead of two.
Examples
Case-insensitive log audit
ERROR timeout
Error resolved
error cleared
Find: error · Mode: Ignore case3 matches · 3 lines with matches · First: line 1, column 1 · Last: line 3, column 1Ignore-case mode folds both sides before matching, then maps each hit back to its original position.
Whole-word boundaries
cat category tomcat cat
Find: cat · Mode: Whole word2 matches · line 1 columns 1 and 20Intl.Segmenter treats only the two standalone cat tokens as whole words; category and tomcat are skipped.
Overlapping hits
aaaa
Find: aa · Overlapping: on3 matches · line 1 columns 1, 2, 3Overlapping mode advances one character after each hit, so the three possible aa spans are all counted.
Use cases
Compliance term audit
Check how often a banned or required phrase appears in a draft and record each line for review.
Keyword density
Measure how often a target phrase appears relative to the word count of an article or landing page.
Log triage
Count an error code or message in a pasted log and jump to the lines where it occurs.
Pattern discovery
Use regex mode to locate every timestamp, ticket ID, or email address that matches a shape rather than an exact string.
Common mistakes
Mistake:Using regex mode with literal text that contains ., +, (, or [.
Fix:Keep metacharacters in literal mode unless you intend them as pattern syntax; escaping them manually is easy to get wrong.
Mistake:Assuming a word processor's find count uses whole-word or overlapping semantics.
Fix:Choose Whole word for standalone tokens and enable Overlapping when hits such as aa inside aaaa must all count.
Mistake:Running a nested quantifier pattern such as (a+)+ over a long log.
Fix:The tool rejects known backtracking patterns; rewrite them as a bounded or non-nested pattern before counting.
Frequently asked questions
How do whole-word boundaries work with hyphens and apostrophes?
Whole-word mode uses Intl.Segmenter with word granularity rather than the ASCII \b boundary. Apostrophes are separate tokens, so cat in cat's is counted, while a hyphenated compound such as cat-like is one word and cat is not counted inside it. This matches Unicode word segmentation more closely than a regular expression boundary.
What does overlapping count mean?
By default the scan resumes after each complete match: aaaa contains two non-overlapping aa hits at positions 1 and 3. With Overlapping enabled it resumes one character later, so positions 1, 2, and 3 are all counted. Overlapping applies to the literal, ignore-case, and whole-word modes.
How do I count with a regex, and what happens if the pattern is invalid?
Choose Regex and enter the pattern without surrounding slashes. The tool compiles it with the global flag plus optional ignore-case and multiline flags. A malformed pattern such as [a- shows the engine's SyntaxError with the offending part of the pattern highlighted, and your input is kept so you can edit it.
Why are some regex patterns rejected, and why are zero-length matches skipped?
Patterns with nested quantifiers such as (a+)+ or quantified groups with overlapping alternatives such as (a|aa)+ can backtrack catastrophically on long lines, so they are refused before execution. Zero-length matches from patterns such as (?=a) are skipped and the scan advances one character; otherwise an infinite loop would freeze the tab. Counts, the per-line table, and the CSV are capped at 10,000 retained matches while the displayed total stays exact.
Is my text uploaded anywhere?
No. Counting, case folding, regex matching, and CSV generation all happen locally in your browser. Nothing leaves your browser, so logs, compliance drafts, and other private text stay in the tab.
References & standards
Related tools
Anagram Solver & Palindrome
Normalize text for palindrome checks and privacy-preserving anagram analysis.
Binary Text Translator
Convert text to binary or hex bytes and decode it back
Braille Translator
Translate text to Unicode Braille and back with UEB Grade 1 letters, numbers, punctuation and a per-cell dot breakdown.
Caesar Cipher Tool
Encrypt, decrypt and brute-force Caesar shifts with English-frequency ranking and a one-click ROT13 shortcut.
Case Converter & Text Formatter
Convert text between 14 different case formats including camelCase, snake_case, kebab-case with batch processing and advanced options
Character Frequency Analyzer
Count character, letter and word frequencies for text analysis