in reply to Non-greedy regex behaves greedily
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:<body>
* finds 0 or more characters. That should solve it! :)s/<body.*?>/<body class="theBody">/is
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Non-greedy regex behaves greedily
by fourmi (Scribe) on Nov 11, 2004 at 13:56 UTC |