lua-users home
lua-l archive

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


> What I'm looking for is the ability to include the delimiter in the strings.
> 
> The following desirable example with '\' as the escape character:
> 
> 'foo','bar','foo,bar' = split('foo,bar,foo\\,bar' , ',')

One nice technique to know is to change exceptions to markers, such as \1:
	s:gsub("\\,","\1"):split(",")
and then change "\1" back to "\\,".

See http://www.lua.org/pil/20.4.html .