模板:Find page text/doc
外觀
| 此頁面是Template:Find page text的模板文件。 此頁面可能包含了模板的使用說明、分類和其他內容。 |
| 此模板使用Lua語言: |
| 此模板文件被引用於約161,000個頁面,佔全部頁面的2%。 為了避免造成大規模的影響,所有對此模板文件的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此模板文件中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
Wrapper for findpagetext function in Module:String2.
Template:Find page text returns the position of a piece of text in the wikitext source of a page.
本模板於2024年5月26日 (日) 01:38 (UTC)通過議案Special:Diff/82782106設立。
參數
[編輯]The template takes up to four parameters:
|1=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.
範例
[編輯]{{Find page text |Youghiogheny}}→ 967{{Find page text |text=Youghiogheny}}→ 967{{Find page text |text=Youghiogheny|nomatch=0}}→ 967{{Find page text |text=Youghiogheny|title=Boston Bridge|nomatch=not found}}→ not found{{Find page text |text=river|title=Boston Bridge}}→{{Find page text |text=river|title=Boston Bridge|nomatch=not found}}→ not found{{Find page text |text=[Rr]iver|title=Boston Bridge|plain=false|nomatch=not found}}→ not found{{Find page text |text=%[%[|title=Boston Bridge|plain=f}}→{{Find page text |text=%{%{[Cc]oord|title=Boston Bridge|plain=f}}→
The search is case-sensitive, so Lua pattern matching is needed to find river or River. The last example finds {{coord or {{Coord. The penultimate example finds a wiki-link.
參見
[編輯]- {{if in page}}