4 ms·
I consider myself a decent regex-er, but, despite several attempts over the years (admittedly all in moments when I had an urgent problem to solve), I still don
by jaza 5y ago
I consider myself a decent regex-er, but, despite several attempts over the years (admittedly all in moments when I had an urgent problem to solve), I still don't get lookbehinds / lookaheads, and end up finding some way to do without them.
Nice to see some examples of how ugly lookbehinds / lookaheads can be. And nice to have a new trick for avoiding them!
Although personally, I still think the most pragmatic solution in this case is usually to just filter out "Tarzan" values somewhere other than in regex.
- justsomeuser 5y agoLook(ahead|behind)s do not consume any of the string which is probably where they confuse people. I see non-look regexes as stepping over each of the characters where you can never go back in time - once a char is stepped over it is gone. “Looks” allow you to step over characters to true|false match them, then step back in the string as if the look did not exist.