Module:Sandbox/Mr. Ibrahem Explained

local p =

function p.count_ref(frame) -- local title = frame.args[1] local _; local page_title_object = mw.title.new(title); local text = page_title_object:getContent; local count; _, count = mw.ustring.gsub (text or , '[1])' local tstart, tend = text:find (pattern, 1, false); --mw.ustring.find(source_str, pattern, start_pos, plain) local total = 0; while tstart do --mw.log(mw.ustring.sub(text, tstart, tend)) ref = text:sub(tstart, tend) mw.log(ref) total = total + #ref; tstart = tend; tstart, tend = text:find (pattern, tstart, false); end return total;end

return p

Notes and References

  1. /