Module:String2b/doc
This is the documentation page for Module:String2b
This template uses Lua Module:GetParameters
{{Lmd|String2}}
The findpagetext function returns the position of a piece of text in the wikitext source of a page. It takes up to four parameters:
- First positional parameter or |text is the text to be searched for.
- Optional parameter |title is the page title, defaults to the current page.
- Optional parameter |plain is either true for a plain search (default), or false for a Lua pattern search.
- Optional parameter |nomatch is the value returned when no match is found; default is nothing.
- Examples
{{#invoke:String2b |findpagetext |text=Youghiogheny}}
→ 701{{#invoke:String2b |findpagetext |text=Youghiogheny |nomatch=not found}}
→ 701{{#invoke:String2b |findpagetext |text=Youghiogheny |title=Boston Bridge |nomatch=not found}}
→ not found{{#invoke:String2b |findpagetext |text=river |title=Boston Bridge |nomatch=not found}}
→ not found{{#invoke:String2b |findpagetext |text=[Rr]iver |title=Boston Bridge |plain=false |nomatch=not found}}
→ not found{{#invoke:String2b |findpagetext |text=%[%[ |title=Boston Bridge |plain=f |nomatch=not found}}
→ not found{{#invoke:String2b |findpagetext |text=%{%{[Cc]oord |title=Boston Bridge |plain=f |nomatch=not found}}
→ not found
The search is case-sensitive, so Lua pattern matching is needed to find river
or River
. The last example finds {{coord
and {{Coord
. The penultimate example finds a wiki-link.
The Template:Findpagetext is a convenience wrapper for this function.