Changes
Jump to navigation
Jump to search
Line 59:
Line 59:
− +
Line 407:
Line 407:
− +
Line 583:
Line 583:
− +
per edit request (permalink);
Parameters
Parameters
s: The string to return a subset of
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
i: The first index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
j: The last index of the string to return, defaults to the last character.
if plain then
if plain then
pattern = str._escapePattern( pattern )
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
replace = string.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
end
]]
]]
function str._escapePattern( pattern_str )
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
return ( string.gsub( pattern_str, "[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%0" ) )
end
end
return str
return str