I have not been able to find any fancy way to do this.
str = "here you have a long list of words" str = str:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end) print(str)
This code output is here, you have a long list of words. %w* can be changed to %w+ so as not to replace words with a single letter.
Fancier Solution:
str = string.gsub(" "..str, "%W%l", string.upper):sub(2)
It is not possible to make a real replacement for a single regex because the lua pattern system is simple.
n1xx1
source share