in reply to Non-greedy regex behaves greedily

Yes, the left hand side (except for the last closing bracket)
<body.+?
is finding out to
<body>
and then continuing out till it hits the next closing bracket. Problem is + finds AT LEAST one character. You want the star * here:
s/<body.*?>/<body class="theBody">/is
* finds 0 or more characters. That should solve it! :)

Replies are listed 'Best First'.
Re^2: Non-greedy regex behaves greedily
by fourmi (Scribe) on Nov 11, 2004 at 13:56 UTC
    indeedy, thanks a lot