View Single Post
Old 08-03-2019, 05:33 PM   #30
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,709
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The main difference is that <p[^>]+> will never get "greedy" no matter what kind of regex engine or settings might be being used. Whereas <p.*?> is inherently greedy and can include more than you want.

It's just generally considered a bit universally safer when trying to limit your match to within a single html element. It will never cross the single tag boundary.

Try your original regex <p.*?> on the following markup for example:
Code:
<p><span class="rule_24">The Everyman’s</span> description</p>
EDIT: What @Tex2002ans said... with an example.
DiapDealer is offline   Reply With Quote