lua-users home
lua-l archive

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


>  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