PHP Regular expressions, end up with just dollar amount and decimal

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.

Thanks!
interclubsAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
käµfm³d 👽Connect With a Mentor Commented:
Correction (I forgot about the decimal point!):
$result = preg_replace("/[^\d.]/", "", $source);

Open in new window

0
 
käµfm³d 👽Commented:
So something like this?
$result = preg_replace("/\D/", "", $source);

Open in new window

0
All Courses

From novice to tech pro — start learning today.