[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: extension to string.gmatch (structural regular expressions)
- From: Shmuel Zeigerman <shmuz@...>
- Date: Thu, 03 Jan 2008 13:50:51 +0200
Miles Bader wrote:
Though in many cases, you don't really need split, e.g. something like
the following is actually cleaner than doing a split and iterating over
the resulting table:
for field in string.gmatch (STRING, "[^ \t\n]+") do
.... use field ...
And what if the fields are delimited by, say, "<delim>" ?
The rule of thumb is to use gmatch when fields are easier to express
with regexp than delimiters, otherwise use split (provided it's
available :) ).