Add string.escapepattern function
This commit is contained in:
parent
ad6e49c136
commit
87e001d4e9
@ -91,3 +91,13 @@
|
|||||||
return self .. "s"
|
return self .. "s"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Returns the string escaped for Lua patterns.
|
||||||
|
---
|
||||||
|
|
||||||
|
function string.escapepattern(s)
|
||||||
|
return s:gsub("[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%0")
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user