Template:Strreplace

ShoutWiki — express yourself and be heard!
Jump to navigation Jump to search
Template:Strreplace invokes Module:String using Lua.

Some or all matches of a pattern replaced by a another string

Use[edit source]

{{Strreplace|string|pattern|replacement|count=integer|plain=Boolean}}

string
the string to search
pattern
the substring to find
replacement
(optional) the string to substitute for pattern
count
(optional, default: all) the number of matches to replace
plain
(optional, default: true) pattern should be considered literal text rather than a Lua pattern expression

Examples[edit source]

{{Strreplace|abc3c%d|c%d| x}}

produces

abc3 x


{{Strreplace|abc3c%d|c%d| x|plain=false}}

produces

ab xc%d


{{Strreplace|abc3c%d|c|count=1}}

produces

ab3c%d