PHP Regular expressions, end up with just dollar amount and decimal
Posted on 2011-09-08
I am trying to extract the dollar amount from a bunch of strings, that contain data other than just the dollar amount. So I would basically want to throw away everything that isn't a number or a period.
Some examples of input and what I want from the regex:
'$100.43 USD' > '100.43'
' $ 1,200 US' > '1200'
'' > '' //empty would still be empty.