mirror of
https://github.com/lazuscripts/utility.git
synced 2024-11-16 03:14:21 +00:00
10 lines
259 B
Plaintext
10 lines
259 B
Plaintext
|
escape_similar_to = (str) ->
|
||
|
-- matches any of %_\|*+?{}()[]
|
||
|
-- puts a backslash in front of them
|
||
|
str = str\gsub "[%%_\\|%*%+%?{}%(%)%[%]]", "\\%1"
|
||
|
return str -- return on seperate line to avoid returning 2nd value from gsub
|
||
|
|
||
|
{
|
||
|
:escape_similar_to
|
||
|
}
|