[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Suggestion for new pattern item like %bxy
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 15 Feb 2017 01:58:33 +0000
2017-02-15 0:32 GMT+00:00 Tony Papadimitriou <email@example.com>:
> I would like to suggest the addition of a new pattern item which will behave
> just the like the %bxy one but will return the match without the xy part.
> (This should be a simple, low overhead addition.)
As a default response for that kind of suggestions, if it's that
simple and low overhead, you should definitely implement it yourself
and use that in your own projects. You can modify Lua, and if you want
to use prebuilt Lua binaries you can wrap string module functions in
your Lua code.
> Does anyone else see any merit (or problem, other than the usual minimalism
> objections) in this proposal?
There's merit, I too use the inside more often than the whole.
Currently there is only one capturing pattern, and there isn't a
single pattern that does matching and capture at the same time, which
is what you're proposing to introduce. So it's a whole new class of
patterns that should be added. It's usually not a big deal to go from
n to n+1, except when n is 0 or 1. I'm not saying it shouldn't be
done, but we probably need more than a couple users saying they'd like
that feature to offset the cost.