Template:Template usage: Difference between revisions
Appearance
No edit summary |
quotes don't work as stated? |
||
| Line 11: | Line 11: | ||
A filter is always recommended for, what is expected, an insource:/regexp pattern/. | A filter is always recommended for, what is expected, an insource:/regexp pattern/. | ||
-->{{#if:{{{pattern|}}}<!-- Do insource. If no pattern, hastemplate is done. | -->{{#if:{{{pattern|}}}<!-- Do insource. If no pattern, hastemplate is done. | ||
-->| insource: | -->| insource:/\{<!-- 1st a space. Start /\{regexp/ with escaped curly bracket. | ||
-->[{{#invoke:String|sub<!-- | -->[{{#invoke:String|sub<!-- | ||
Now save from an expensive, /regexp/i, case-insensitive search | Now save from an expensive, /regexp/i, case-insensitive search | ||
| Line 20: | Line 20: | ||
Trickiest part: [character class "any char NOT^ a } ] "one or more of"+. | Trickiest part: [character class "any char NOT^ a } ] "one or more of"+. | ||
-->[^}]*<!-- Zero or more (*) of the [character class], "NO^ curly brackets". | -->[^}]*<!-- Zero or more (*) of the [character class], "NO^ curly brackets". | ||
-->{{{pattern}}}/ | -->{{{pattern}}}/<!--User part: the sub-pattern regexp, match within template. | ||
And you see the ending / of the regexp/. | And you see the ending / of the regexp/. | ||
Its in "quotes" to allow for spaces in the pattern. | Its in "quotes" to allow for spaces in the pattern. | ||
Revision as of 01:03, 24 June 2015
File:Test Template Info-Icon - Version (2).svg Template documentation[create] [purge]
Phase one of two: a test regexp "{{{pattern}}}". Perform a search for template Val on just this page.