"regex - how to extract price?" Answer’s

0

I'm no regex-guru, but was able to whip up the following with RegExr.

/($[0-9]+(.[0-9]{2})?)/

Matches $35.03 and $35. To accept formats like $35,000.52 you would need to include ,

/($[0-9,]+(.[0-9]{2})?)/

This could likely be improved upon, but from my preliminary tests, it works just fine.

Wednesday, March 31, 2021
 
cegfault
answered 10 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share