string - Lua gsub case and frontier pattern -
string - Lua gsub case and frontier pattern -
using lua 5.1 , gsub function how implement case sensitive/case insensitive , frontier pattern matching alternative count substrings?
countsubstring = function(s,ctrlid) --< s = string count local t = scintilla.gettext(ctrlid) if findreplace.findcase == 0 --< no case if findreplace.findwhole == 0 --< no whole word local _,count = string.gsub(t,s," ") homecoming "found "..count .." occourances of "..s else --< whole word local _,count = string.gsub(t,s," ") homecoming "found "..count .." occourances of "..s end else --< case if findreplace.findwhole == 0 --< no whole word local _,count = string.gsub(t,s," ") homecoming "found "..count .." occourances of "..s else --< whole word local _,count = string.gsub(t,s," ") homecoming "found "..count .." occourances of "..s end end end;
i've got older post here frontier pattern it's having case/non case also.
string lua gsub scintilla lua-patterns
Comments
Post a Comment