lua-users home
lua-l archive

Re: conditional replace

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


On Sep 17, 2007, at 4:36 PM, Tomas Guisasola Gorham wrote:
	Hi Thomas
for l in string.gfind(MyText,"localgreek%b{}") do
 l = string.gsub(l,'a','α')
 print(l)
end
	You can use gsub for everything:
-- untested
string.gsub (MyText, "localgreek(%b{})", function (l)
	return string.gsub (l, 'a', 'α')
end)
	Tomás
Hi Tomás!
This looks very promising and very elegant! I'll try to construct a dictionary for the substitutions, and then I would be done! Thanks a lot
Thomas

AltStyle によって変換されたページ (->オリジナル) /