std.escape_magic_chars

std

escape_magic_chars(str) -> escaped

Escape Lua pattern magic characters in a string

Prepends % before each of the eleven Lua pattern magic characters: + * % . $ [ ] ? ( ) -. The result is safe to use as a literal pattern inside string.find, string.match, etc.