lua-users home
lua-l archive

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


> >Another solution is like this:
> >
> >  line = ' '..line..' '
> >  line = gsub(line, '(%W)'..s..'(%W)', '%1'..sh..'%2') -- in the middle
> >  line = strsub(line, 2, -2)
	In fact, you'll have to be carefull with punctuation.
If s == "a.b" you'll have to escape it before using in the
pattern:

s = gsub (s, "(%p)", "%%%1")

	So, "a.b" will be "corrected" to "a%.b".  This is required for
every solutions given (mine, Roberto's ...).

	Tomas