3 ms·
I haven't completely ingested this post yet, but this seems to be incorrect: > I'm pretty sure you can emulate the absent operator with look-ahead expressions.
by runako 10y ago
I haven't completely ingested this post yet, but this seems to be incorrect:
> I'm pretty sure you can emulate the absent operator with look-ahead expressions. Untested: (?=((?!exp).)*$)
From TFA: "Note that this is not the same as a negative look-behind or look-ahead — we’ll see how shortly."
- perlgeek 10y agoWell, it's not the same as a simple positive or negative look-ahead, but that's not what I proposed either.
- falsedan 10y agoThe article explains that (?~foo) is not the same as (?!foo), since the latter fails the match if it matches, but the former succeeds if it can match anything that's not 'foo' (including 'oo'). The first examples anchor the patterns, so that this behaviour: "foo" ~= /(?~foo)/ # => 1 isn't revealed.