Try put this in a immediate window
?val(" 1 2 345 6.7 8,9 hsfg h 56 34")
You'll notice that Val searches for the number's, ignores spaces, stops whenever it finds other characters, only accepts "." as decimal separator