This template uses the following Lua module: Changes to this template will need to be made there. |
{{match|string|pattern|init=optional|ifMatch=optional|ifNo=optional}}
This template looks for the first match of the pattern in the string and returns it. It uses the mw.ustring.match() function to do this. The pattern must be a Lua pattern. Lua patterns are essentially a nerfed version of regular expressions.
TemplateData edit
Looks for the first match of a pattern in a string and returns it.
Parameter | Description | Type | Status | |
---|---|---|---|---|
String | 1 | The string to search. | String | required |
Pattern | 2 | The pattern that the string should be searched for. Must be a Lua pattern, which is like a regular expression but nerfed. | String | required |
init | init | The position in the string to start searching in from.
| Number | optional |
ifMatch | ifMatch | What the template outputs if a match is found. If this parameter is "MATCH" or left undefined, then the match itself would be returned.
| String | optional |
ifNo | ifNo | What the template outputs if no match is found.
| String | optional |