function matchsent(text) text = string.gsub(text, '%.%s+(%u)', '.§%1') for sent in string.gmatch(text, '[^§]+') do print(sent) print("---") end end matchsent("Dr.Bonn was hiding in a tree.\nAnother one.")