Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a22ae3d4aa803a24

Jump to content

Module talk:User:Mr. Stradivarius/String count

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 7 years ago by RMCD bot in topic Move discussion in progress

Move discussion in progress

[edit]

There is a move discussion in progress on Wikipedia talk:Lua which affects this page. Please participate on that page and not in this talk page section. Thank you. RMCD bot 05:03, 27 December 2018 (UTC)Reply

Basic usage

[edit]

This module counts the number of times a string of characters appears in a Wikipedia article – more specifically in the wikitext markup. This makes it possible to also count formatting-related strings such as: <ref> |url |EpisodeNumber.
The following expression will be rendered as an integer corresponding to all occurrences of the string israel in the article about Donald Trump.

{{#invoke:User:Mr. Stradivarius/String count|count|page=Donald Trump|search=israel}}

The |search argument of the count function is case-sensitive. In the above example when searching for the string israel a value of 7 is obtained, searching for Israel yields 14. If the above expression is used within the article that's being analyzed it will also be counted by the script into the grand total string count. The #expr parser function can be used to perform basic arithmetic allowing for the original string count to be displayed in the article. The following expression can be used to perform said arithmetic.

{{#expr:{{#invoke:User:Mr. Stradivarius/String count|count|page=|search=}}-1}}