local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame)
local str = args[1] or ''
local rep = args[2] or ''
local to = args[3] or ''
if str == '' or rep == '' then return '参数不正确。' end
local newStr, matchs = mw.ustring.gsub(str, rep, to)
return newStr
end
p.test1 = {
'hello, world',
'world',
'小可爱'
}
p.test2 = {
'hello, [[world]]',
'%[%[(.+)%]%]',
'<b>大可爱</b>'
}
return p
-- mw.log(p.main(p.test1))