lua-users home
lua-l archive

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


> BTW, \1 is octal \001?
	Yes.  The best choice is a character that will not be present in
the string (like '\n', as Luiz noted).
	Another thing you must need is a escape for `"' inside a quoted
string.  For example:

cmd first-arg "second arg" 3 "a\"b" de "fg"

	Must be splitted in:

1       cmd
2       first-arg
3       second arg
4       3
5       a"b
6       de
7       fg

	To achieve that, just add the following line as the first substitution:

s = gsub(s,'\\"','\2')

	And change the correction of the `\1', to correct these too:

local s=gsub(gsub(str,'\1',' '), '\2', '"')

	Got it?

		Tomas