string - Lua Parse After Match -
using lua 5.3 i'm trying parse string looks like.
a=data0 b=data c=data a=data1 b=data c=data a=data2 ...
i want parse 'b=data & c=data' after occurrence of 'a=data1'. know can start doing string.find(examplestring, 'a=data1')
give me start/end position , know start parsing b after don't know how long 'data' after that, don't know start parsing 'c'? there anyway can parse next line type of thing? how else should tackle this?
know start parsing b after don't know how long 'data' after that, don't know start parsing 'c'? is there anyway can parse next line type of thing?
yes, can match eol character:
for letter, data in s:gmatch('(%w)=(.-)\n') print(letter,data) end
.-
= 0 or more characters, few possible
\n
= eol character
parentheses capture parts of pattern want gmatch return.
you ([^\n]*)
means 0 or more character not newline.
Comments
Post a Comment