lua-users home
lua-l archive

Re: string parsing vs hddtemp question

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


Le 18/03/2013 12:44, Luiz Henrique de Figueiredo a écrit :
>> for _, mnt,tp,temp,unit in s:gmatch("((/dev/[^|]+)|([^|]+)|([^|]+)|([^|]+)[|]?[^/]+)") do
>> 	print(mnt, tp, temp, unit)
>> end
> The key to make this simpler is to make the string uniform by appending a
> separator at the end and to use - instead of +.
>
> s=s.."|"
> for mnt,tp,temp,unit in s:gmatch("|(.-)|(.-)|(.-)|(.-)|") do
> print(mnt, tp, temp, unit)
> end
>
Thanks to both of U : it's working very well thank you :)
But I still don't understand why my "(%a.+)" didn't work and extract the
remaining of the line.

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