core: ported regex.gsub to faster native version (#1233)
* added regex.gmatch iterator and other fixes * fixed issues reported by Guldoman * push strings with fixed len just in case for binary safety * added limit to regex.gsub and use pushinteger * added description to regex.gsub limits param * replaced substitutions regex description for correctness * ignore negative limits on regex.gsub
This commit is contained in:
@@ -216,7 +216,7 @@ command.add("core.docview!", {
|
||||
return text:gsub(old:gsub("%W", "%%%1"), new:gsub("%%", "%%%%"), nil)
|
||||
end
|
||||
local result, matches = regex.gsub(regex.compile(old, "m"), text, new)
|
||||
return result, #matches
|
||||
return result, matches
|
||||
end)
|
||||
end,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user