Template documentation
This template uses {{#invoke:String|match}} to display text which indicates if a string matches a pattern. It is designed for use in documentation.
Usage
Pattern shown in output
{{String match test|STRING|PATTERN}}
{{String match test|s=STRING|pattern=PATTERN}}
Pattern not shown in output
{{String match test|STRING|PATTERN|show-pattern=no}}
{{String match test|s=STRING|pattern=PATTERN|show-pattern=no}}
Examples
Pattern shown in output
{{String match test|john-smith-1|[a-z][a-z-]+[a-z0-9]}}
john-smith-1
matches the pattern [a-z][a-z-]+[a-z0-9]
{{String match test|s=/john-smith|pattern=[a-z][a-z-]+[a-z0-9]}}
/john-smith
does not match the pattern [a-z][a-z-]+[a-z0-9]
Pattern not shown in output
{{String match test|john-smith-1|[a-z][a-z-]+[a-z0-9]|show-pattern=no}}
john-smith-1
matches the pattern
{{String match test|s=/john-smith|pattern=[a-z][a-z-]+[a-z0-9]|show-pattern=NO}}
/john-smith
does not match the pattern