Request: \K · Issue #151 · mrabarnett/mrab-regex (original) (raw)
Original report by boolbag NA (Bitbucket: boolbag, GitHub: boolbag).
Hi Matthew,
Thank you as always for the terrific engine.
In my view it's one of the very best engines out there.
There are three missing features that have been "talking to me" for a while, and I thought I'd put in some requests. I'm sure you've considered them before, but I'd like to put forward a case for each of them.
In this thread I'll focus on \K
.
I realize that \K
was originally intended as a workaround for the lack of infinite lookbehind.
Nevertheless, it is an extremely clean and expressive token.
Without \K
, you either have to use a lookbehind or capturing groups.
Not a problem, but within long expressions, \K
gives you a clean "drop everything matched so far".
Also, I often have to translate many expressions from PCRE to Python. When the PCRE expressions are rich with \K
, the absence of \K
in regex
is a real speed bump.
Thanks in advance for considering it again.