in reply to Re^2: Why is variable length lookahead implemented while lookbehind is not?
in thread Why is variable length lookahead implemented while lookbehind is not?
When you write a backtracking regex engine like the one in Perl 5, a full (variable length) look-ahead is pretty easy to implement.It seems to me that the easy solution would produce bad performance. The easy solution requires matching each lookbehind subpattern at pos $current_pos - $max_match_length
(emphasis mine)
It seems we're talking about two different things here. The simple approach for look-ahead is not slow (at least if you take care not to backtrack the look-ahead). And that's probably the reason it's implemented in Perl, and most advanced regex engines.
In the case of look-behind, we're in violent agreement :-)
|
|---|