in reply to Negative Lookahead Assertion Strangness
In example 4, the .* will first eat the whole string and then the foo will fail to match, satisfying the negative assertion :). So the whole string is printed.
Both of these examples show the danger of creating nonlocal assertions. It is easy to do something unexpected when the string tested is some distance from the assertion.