in reply to Why is variable length lookahead implemented while lookbehind is not?

The regex engine won't backtrack to validate a variable width assertion, and that's what would be necessary to make variable width work, from what I understand.

perlre suggests a workaround with \K, and I've seen people suggest that one of the most effective variable width lookbehinds is reverse (process the reversed string instead).


Dave

  • Comment on Re: Why is variable length lookahead implemented while lookbehind is not?

Replies are listed 'Best First'.
Re^2: Why is variable length lookahead implemented while lookbehind is not?
by Kc12349 (Monk) on Sep 07, 2011 at 20:47 UTC

    Thanks. That's very helpful. \K fills any need I occasionally come upon for variable lookbehind.