From: Hugo <[EMAIL PROTECTED]>
Sent: Tuesday, September 12, 2000 2:54 PM

> 3. The regexp is matched left to right: first the lookbehind, then 'X',
> then '[yz]'.

Thanks for the insight - I was stuck in my bad assumption that the optimized
behavior was the only behavior.

What I am not sure of is whether the "optimization" is ever dangerous.  In
other words, is there ever a difference in end-result between, doing at each
point: 1. test look-behind and then test the remainder of the regex, vs 2.
test the remainder of the regex, and then test the look-behind?

Of course, there may be a speed difference, and with fix-length look-behind,
that is almost always going to be the cheaper test.

This was the sense of "greediness" I mentioned in an earlier email - the
difference, for example, between \w+ and \w+?

I am without a motiviating example, but can anyone see utility in a
non-greedy look-behind that operates in sense "2" above?   Syntax:
(?<=pat)?    (?<!pat)?    Currently, a question-mark like this on a
look-behind makes it optional, defeating the assertion's purpose.  If anyone
has a good example, I'll take on writing a RFC.

Reply via email to