Pattern matches
{{If in page|notice|match|no match}}

{{If in page}}

match

{{If in page/sandbox}}

match

Pattern does not match
{{If in page|Non ?Matching ?Pattern|match|no match}}

{{If in page}}

no match

{{If in page/sandbox}}

no match

Pattern matches, no third parameter
{{If in page|notice|match}}

{{If in page}}

match

{{If in page/sandbox}}

match

Pattern does not match, no third parameter
{{If in page|Non ?Matching ?Pattern|match}}

{{If in page}}


{{If in page/sandbox}}


Pattern matches, no second parameter
{{If in page|notice}}

{{If in page}}


{{If in page/sandbox}}


Other page, pattern matches
{{If in page|%{%{#invoke:|match|no match |page=Template:Infobox}}

{{If in page}}

match

{{If in page/sandbox}}

match

Other page, pattern does not match
{{If in page|Non ?Matching ?Pattern|match|no match |page=Template:Infobox}}

{{If in page}}

no match

{{If in page/sandbox}}

no match

Invalid pattern, can crash
{{If in page|%|match|no match}}

{{If in page}}

Lua error: malformed pattern (ends with '%').

{{If in page/sandbox}}

Lua error: malformed pattern (ends with '%').

Leading and trailing whitespace
{{If in page| b?b |match|no match}}

{{If in page}}

match

{{If in page/sandbox}}

match

Leading and trailing whitespace workaround
{{If in page|( b?b )|match|no match}}

{{If in page}}

no match

{{If in page/sandbox}}

no match

Bad title
{{If in page|pattern|match|no match |page=Talk:Template:If in title}}

{{If in page}}

no match

{{If in page/sandbox}}

no match

Non existent page
{{If in page|pattern|match|no match |page='''This does not exist'''}}

{{If in page}}

no match

{{If in page/sandbox}}

no match

sub=yes
{{If in page|(mat)ch|%1|no match |sub=yes}}

{{If in page}}

mat

{{If in page/sandbox}}

mat