[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Equivalent to scanf()?
- From: Miles Bader <miles.bader@...>
- Date: Wed, 14 Nov 2007 17:51:49 +0900
KHMan <keinhong@gmail.com> writes:
> Or something similar. Then use regular expressions to parse the
> line, perhaps using string.gmatch or something like that. A simple
> regex would be "[^,]+".
BTW, once you go beyond the most simple patterns, try learning LPeg --
it has something of a learning curve, but it's _really_ expressive and
easy to use once you get your head around it, and very powerful.
LPeg also seems a little faster than using lua's builtin regexp stuff,
and usually the lpeg grammar can be quite precise (whereas using regexps
I usually find it necessary to be somewhat sloppy).
-Miles
--
Next to fried food, the South has suffered most from oratory.
-- Walter Hines Page