No, there is no difference. I just thought it would be a little bit more efficient. I thought that, if the \K is outside, the $& variable is being cleaned up for every substitution, which is not really necessary. It should be cleaned only when something on the left side has been matched. Anyway, it is more readable in your way, and does, basically, the same thing. :)

Alternatively, to work with strings that contain {{...}} groups, which are not followed by a newline, this code should do it: