On 7/2/07, Rici Lake <lua@ricilake.net> wrote:
If you don't care about losing empty lines, the easiest way is:
for line in str:gmatch"[^\n]+" do ... end
(This also might leave a trailing \r on the end of line, if
your input was created with them.)
If you only wanted lines which started with the word "Project",
you could use:
for line in str:gmatch"Project[^\n]*" do ... end
etc.
Thanks. This worked perfectly.
It's not clear to me why you have the literal string gtxAdvanced in
your example pattern, but even if you fixed that, the .* on either
side of it are greedy, so the pattern is not going to do what you want.
If possible, it's preferable to use negative character spans (like
[^{}]*) rather than non-greedy .-, but sometimes .- is a lot easier.
I am using that so I can be sure to only find that particular GUID. Lua once again saves my day. ;-)