Quote:
Originally Posted by Thom*
Interesting, I am new to this and was not familiar with ^. The concern I have is that your search would not find:
<span class="calibre5">Now is the time for all <i>good men</i> to enjoy a coke.</span> or:
<span class="calibre5">Now is the time for all <em>good men</em> to enjoy a coke.</span>
|
Correct.
But it will also not match:
Code:
<span class="calibre5">Now is the time for all <span class="italic">good men</span> to enjoy a coke.</span>
Whereas the first <span class="calibre5">(.*?)</span> might match:
<span class="calibre5">Now is the time for all <span class="italic">good men</span> to enjoy a coke.</span>
and create malformed html when replaced.
I'd rather have to make a second pass for the calibre5 spans that didn't get picked up with the first search than have the first search botch my html.
I usually try to avoid using regex for matching ending tags with opening tags entirely (especially in potentially nested situations).