I need to get a price from one item and add it to another.
I use this:
\$\d+(?:\.\d+)?
It seems to work for $0.50
, $1.00
, $20.00
, $200.00
, but I hit a brick wall at $1,000.00
and $ 10,000.00
( $10,000.00
unlikely to ever be used).
The wrist is turning me off.
** Change **
I took an hour to get back to the heaps of answers. Before I go through them, I thought that I would clarify and not answer all the comments:
The platform used automatically generates the total number of items in the shopping cart. It receives the visualization in the element - this changes depending on whether the user adds or removes.
The value is unlikely to go to 10,000.00, because the cost of the product is not so high.
I am new to using regex and it took me a while to get this far, so the question is.
Auto-generated HTML:
<span vertical="False" quote="False" id="catCartSummary"> <table cellspacing="0" class="cartSummaryTable"> <tbody> <tr> <td class="cartSummaryItem">3 item(s), Total: $115.00 <a href="#" class="cartSummaryLink">View Cart</a></td> </tr> </tbody> </table> </span>
I just need the $ value in this case $ 115.00 - But I need it to work for $ 1,000.00
source share