Template:ifmatch/documentation
Jump to navigation
Jump to search
Uses Lua:
{{ifmatch|string with pattern in it|pattern|pattern was found|pattern wasn't found}}
{{ifmatch|s=string with pattern in it|pattern=pattern|if_true=pattern was found|if_false=pattern wasn't found}}
↓
- pattern was found
- pattern was found
Turn off Lua pattern syntax:
{{ifmatch|string with Lua pattern syntax %d matching number in it|%d|pattern was found|pattern wasn't found}}
{{ifmatch|string with Lua pattern syntax %d matching number in it|%d|pattern was found|pattern wasn't found|plain=true}}
↓
- pattern wasn't found
- pattern was found
Turn off Unicode features (mw.ustring):
{{ifmatch|string with non-ASCII numbers ٠١٢٣٤ in it|%d|pattern was found|pattern wasn't found}}
{{ifmatch|string with non-ASCII numbers ٠١٢٣٤ in it|%d|pattern was found|pattern wasn't found|unicode=false}}
↓
- pattern was found
- pattern wasn't found
{{#if:}}
is used, so if the |if_true=
or |if_false=
argument isn't visible, it doesn't have side effects:
{{ifmatch|string with pattern in it|pattern|pattern was found|{{DISPLAYTITLE:This display title won't be evaluated, so there isn't a "display title was ignored" error message in preview mode.}}}}
↓
- pattern was found