[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: Paul K <paul@...>
- Date: Tue, 14 Jul 2015 17:42:01 +0000
>> When will the above be different from ps:gmatch("%d+") ?
> when a more ethical Lua gets developed, and we get "moderately greedy"
> patterns that consume only a fair share of characters. :-)
Indeed ;). I was thinking about a more complex pattern for extracting
numbers, which in this case wasn't needed:
ps = "1,22,33,4444,abc123def"
for n in ps:gmatch("%f[%w](%d+)%f[%W]") do
This would only extract "standalone" numbers (and not those that are
part of words).