[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: Paul K <paul@...>
- Date: Tue, 14 Jul 2015 17:42:01 +0000
>>> ps:gmatch("(%d+)%f[^%d]")
>> 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
print(n)
end
This would only extract "standalone" numbers (and not those that are
part of words).
Paul.