lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, 12 Dec 2014, Dirk Laurie wrote:

2014-12-12 14:59 GMT+02:00 Thiago L. <fakedme@gmail.com>:
Is there any way I can do

for from,to in string.findpairs("my string", ".") do
  print(from, to)
end

Do you mean this?
_=string.gsub("The quick brown fox jumps over the lazy dog","()%S+()",print)
1    4
5    10
11    16
17    20
21    26
27    31
32    35
36    40
41    44


	Or do you mean this?

=string.gsub("The quick brown fox jumps over the lazy dog", "(%w+)%s+(%w+)", print)
The	quick
brown	fox
jumps	over
the	lazy
The quick brown fox jumps over the lazy dog	4


	Reagards,
		Tomás