View Single Post
Old 06-03-2015, 05:19 PM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,705
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Thom* View Post
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).
DiapDealer is offline   Reply With Quote