Patrick R. Michaud: > Ruud H.G. van Tol: >> Patrick R. Michaud: >>> Ruud H.G. van Tol:
>>>> 's/$/foo/' becomes 's/<after .*>/foo/' >>> >>> Uh, no, because <after> is still a zero width assertion. :-) >> >> That's why I chose it. It is not at the end-of-string? > > Because ".*" matches "", /<after .*>/ would be true at > every position in the string, including the beginning, > and this is where "foo" would be substituted. I expected greediness, also because <after .*?> could behave non-greedy. Just like: s/(.*)/$1foo/ s/(.*?)/$1foo/ OK, so 's/<!before .>/foo/' it must be. But why does <after .*> behave non-greedy? -- Grtz, Ruud