Template:Lua escape
Appearance
Escapes a string to make it suitable as a Lua Scribunto regular expression.
The full set of metacharacters needing escaping in patterns is: ().%+-*?[^$; for now, only hyphen is escaped.[a]
Usage
{{Lua escape|string}}
Parameters
There is one required positional parameter:
|1=– the string to be escaped
Examples
{{Lua escape|uw-vandalism4}}→ uw%-vandalism4{{Lua escape|Template:Please see}}→ Template:Please see{{Lua escape|Template:Uw-c&pmove}}→ Template:Uw%-c&pmove{{Lua escape|Template:A&E original programming}}→ Template:A&E original programming{{Lua escape|Template:D&D-stub}}→ Template:D&D%-stub{{Lua escape|Template:Welcome v2.0}}→ Template:Welcome v2.0 (fails to escape the dot)
See also
- Template:Template usage#Metacharacters
- mw:Extension:Scribunto/Lua reference manual#Patterns
- mw:Extension:ReplaceSet – what we really need, but don't have
Notes
- ↑ Which means this template fails for {{Welcome v2.0/doc}}, currently the only template with {{subst only}} that has a dot in the title.