Regular Expression pattern matching question...

Hi there, I'm trying to split a string using RegExp to extract a price
from it. The price may or may not have a dollar sign in front of it
and may or may not contain a decimal value. Below are some string
examples of what the regular expression would need to handle to split
out the price:

Example 1:
"2 starbuck's coffees 9.99" <- price is 9.99

Example 2:
"99 red baloons 175" <- price is 175

Example 3:
"starbuck's coffee $9.99" <- price is 9.99

Example 4:
"starbucks coffee 9" <- price is 9

So the trouble is: a) in Example 3, I can't count on the dollar sign
being there all the time. Some instances it will, other instances it
won't and b) in the case of Example 2, there may be a number at the
start of the string of indeterminate length that I want to ignore
since this could represent the quantity, not the price.

What would the RegExp look like that would split out the price?

Thanks in advance.

eg /(\d+\.){0,1}\d+$/

g jo

you can always use to test your RexExp.

you can always use to test your RexExp.

This Website does not work correctly.

g jo