Skip to content

Count Occurrences

Count literal text matches with optional case sensitivity and overlapping detection, then inspect exact zero-based positions.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Paste or type the source text you want to search.
  2. 2.Enter the literal text to find and choose case sensitivity and overlap behavior.
  3. 3.Count matches and review the total plus the first 100 zero-based starting positions.

About Count Occurrences

Count Occurrences measures how many times a literal search string appears inside pasted text. Enter up to 1,000,000 characters, enter the text to find, choose case-sensitive or case-insensitive matching, and decide whether matches may overlap. The result reports the total and lists the first 100 starting positions. All searching happens inside the browser, and neither input is sent to Lizely.

Matching is literal rather than regular-expression based. A period matches a period, an asterisk matches an asterisk, and brackets have no special syntax. Users do not need to escape punctuation, and an invalid regular expression can never break the search because no pattern is compiled. The search string can contain spaces, tabs, line breaks pasted into the field, emoji, or ordinary Unicode text up to 1,000 characters.

Non-overlapping mode advances past the entire matched search string. Searching for aa in aaaa therefore finds matches beginning at positions 0 and 2. Overlapping mode advances one JavaScript string unit after a match and finds positions 0, 1, and 2. The explicit option makes both common interpretations available without silently switching behavior based on the input.

Case-sensitive mode compares the entered strings exactly. Case-insensitive mode converts both text and search input with English-locale lowercase behavior before searching while reporting offsets from the original text. This is a practical text utility rather than a full linguistic collation engine. Locale-specific equivalence, normalization between composed and decomposed Unicode forms, accent folding, and script-specific case rules are not inferred.

Positions are zero-based JavaScript string offsets. Most ordinary English characters consume one offset, while characters represented by surrogate pairs can consume two UTF-16 code units. The displayed offsets are intended for reproducible browser and programming work, not as user-perceived grapheme indexes. The tool shows at most 100 positions to keep a result with hundreds of thousands of matches usable, but the reported total is not truncated.

An empty search string is rejected because it would match at every boundary and produce an ambiguous result. Input and search limits protect browser responsiveness and prevent an accidental huge result from freezing the tab. A search longer than the remaining source naturally returns zero. Editing any input or option clears the old output so stale counts cannot be mistaken for current settings.

The tool does not trim source text, change line endings, collapse whitespace, remove duplicates, or rewrite the input. Case folding is used only in the comparison copy. A match can span a newline when the search text contains that newline. There is no whole-word mode, fuzzy matching, stemming, wildcard syntax, Unicode normalization, replacement action, or file upload parser.

Use Count Occurrences for checking repeated words, tokens, separators, log markers, code fragments, IDs, punctuation, or exact phrases. Overlap mode is useful for sequence analysis; non-overlap mode reflects how many separate replacements a simple literal replace operation would make. For counts by word rather than a specified string, use Word Counter. For changing matches, use Find and Replace. For comparing two bodies of text, use Text Diff Checker.

A zero result is a valid answer and displays no positions. Singular and plural labels follow the actual count. The position preview is informational and remains in the page; no download is created because the core output is a small numeric result. The operation is deterministic for the same browser string inputs and options, with no network, randomness, external table, or server state involved.

Methodology & sources

Validate bounded source and non-empty literal search text, optionally lowercase both with the English locale, repeatedly call literal index lookup from the current offset, advance by one unit for overlap mode or by the search length otherwise, retain every count while displaying only the first 100 original-string offsets, and clear results on input changes.

Frequently asked questions

Does the search use regular expressions?
No. The search string is literal, so punctuation such as periods, brackets, and asterisks needs no escaping.
What does overlapping mean?
After a match, overlap mode advances one string unit; non-overlap mode advances by the full search-string length.
Why can an emoji affect position numbers?
Positions are JavaScript UTF-16 string offsets, so some characters use two code units rather than one perceived character.
Is my text uploaded?
No. Matching, counting, and position collection run locally in the browser.

Text Tools guides

View all