2,875
edits
mNo edit summary |
No edit summary |
||
Line 460: | Line 460: | ||
function p._replace(str, searchTerm, replacementTerm) | function p._replace(str, searchTerm, replacementTerm) | ||
if str == nil then | |||
return nil | |||
end | |||
local escapedSearch = searchTerm:gsub("[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%1") | local escapedSearch = searchTerm:gsub("[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%1") | ||
local result = str:gsub(escapedSearch, replacementTerm) | local result = str:gsub(escapedSearch, replacementTerm) |
edits