This template counts the number of strings on the specified page. It uses the most recent saved version of a page, so if used on the current page it will not work correctly in preview mode.

Usage

Plain search

{{string count|page=page|search=text to search for}}

Search with Lua patterns

{{string count|page=page|search=pattern to search for|plain=no}}

Parameters

  • page - the page to search on.
  • search - the string or Lua pattern to search for.
  • plain - set to "no" to search with a Lua pattern instead of plain text.

Lua patterns

A Lua pattern is a special string that can match several different strings. For people who know regular expressions, Lua patterns are similar, but more limited. See the following documentation for how to contstruct patterns:

Note: This module uses unicode-safe Scribunto functions, so there is no need to make special exceptions for unicode characters. However, some character classes may behave differently to the ASCII pattern character classes, so see the unicode string pattern documentation for the most accurate description.

Examples

  • {{string count|page=Wikipedia:Administrators' noticeboard/Incidents|search=admin}} → 0
  • {{string count|page=Wikipedia:Administrators' noticeboard/Incidents|search=[Aa]dmin|plain=no}} → 0