lua-users home
lua-l archive

Re: LPeg and whitespace removal

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


> So, I want to separate the comma separated tokens, trim the left and 
> right whitespace, and preserve the white space in the middle.
> 
> Any ideas?
ws = lpeg.P'*'
sep = lpeg.P','
elem = ws^0 * lpeg.C((ws^0 * (1 - ws - sep)^1)^0) * ws^0
p = elem * (sep * elem)^0
-- Roberto

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