I'm using this regex to get just a number back.
Regex.Replace(foo, "[^.0-9]", "")
How do I make it not remove spaces?
That's easy:
Regex.Replace(foo, "[^.0-9\\s]", "")
You may find the Regex slightly easier to read with the @""
terminology (no need to escape the backslash:
Regex.Replace(foo, @"[^.0-9\s]", "")