Template:If in page/doc

This template searches the current page for a provided Lua mw.ustring pattern. If you need help with these, you could ask Wikipedia talk:Lua, Village pump (technical), or a user who knows Lua.

Note: the pattern is parsed by MediaWiki before being sent to the module, this means templates and magic words are decoded. If you want to add a  pipe character use.

Usage

 * searches the current page for a given pattern
 * can be used to search a page other than the current page
 * if the pattern matches, substitutes,  ,  , etc. in   with first, second, third, etc. capture groups. Does not work with.

Examples

 * would output colour if a page contains Use British English or color if it does not

TemplateData
{	"params": { "1": {			"label": "Pattern", "description": "A valid pattern for mw.ustring.match", "required": true },		"2": {			"label": "Value if present", "description": "The value to output if the pattern matches the content of the page", "type": "content", "suggested": true },		"3": {			"label": "Value if absent", "description": "The value to output if the pattern does not match the content of the page", "type": "content", "suggested": true },		"page": { "label": "Page", "description": "The page to search, if not the current page" },		"sub": { "description": "If set, then value if present will have %n replaced with capture groups, see doc", "type": "boolean" }	} }