Select text following last $ in an expression? : <p>I am using a regular expression to extract the price on the right from the following HTML:</p>

<pre><code>&lt;p class="pricing ats-product-price"&gt;&lt;em class="old_price"&gt;$99.99&lt;/em&gt;$94.99&lt;/p&gt;
</code></pre>

<p>Using preg match in PHP:</p>

<pre><code>preg_match_all('!&lt;p class="pricing ats-product-price"&gt;&lt;em class="old_price"&gt;.*?&lt;\/em&gt;(.*?)&lt;\/p&gt;!', $output, $prices);
</code></pre>

<p>Except, I noticed that sometimes the HTML doesn't include an old price. So sometimes the HTML looks like this:</p>

<pre><code>&lt;p class="pricing ats-product-price"&gt;$129.99&lt;/p&gt;
</code></pre>

<p>It seems like my goal should be to extract the <em>last</em> price from the expression, or in other words the text that directly follows after the last question mark and before the <code>&lt;/p&gt;</code>. This sort of expression is way out of my league though - hoping for some help here. Thanks.</p>
