Reputation: 1088
In Lua, how would one match 123, against a string that is 11122333, and find the 1 and 2 and 3? is there a pattern that can do this? rather than attaching individual character checks?
Upvotes: 3
Views: 133
Reputation: 23767
local str = '11122333'
str = str:gsub('.','\0%0%0'):gsub('(.)%z%1',''):gsub('%z.','')
Upvotes: 2