-3

I'm very new to regex. How do I match a decimalised number. I have found ones that include $ but just need to match any number which could include decimals.

e.g.

100 100.50 707.40 150.00

  • what have you tried? if you found one that includes $, have you thought about how to remove the $ to get what you want? i bet you can figure it out with a little thought. give it a shot. i believe in you. – Robert Levy Jun 19 '14 at 18:42
  • There are many, many, many answers here on SO on how to match numbers, e.g. http://stackoverflow.com/questions/308122/simple-regular-expression-for-a-decimal-with-a-precision-of-2 – Fredrik Pihl Jun 19 '14 at 18:45

1 Answers1

0

It's not very advanced, but:

/\d.*?\.\d.*/

Will match:

2.0 12.00

Won't match:

2 22

Doesn't check if it's a number though.

Art
  • 592
  • 3
  • 10