Take a look at
How to check if a scalar value is numeric or string? and
Need some wisdom on strings to numbers...There is just more than one way to do it .... Earlier, I got stuck trying to perform a regex to do the same too... I found the above two links useful...