[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Split string and escape delimiter
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 1 Jun 2014 11:02:58 -0300
> 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 .