Jay Roy
asked on
regular expression:- validate string of numbers
hi guys
I am looking for a regular expression which will check if there are
any alphabets in a string of numbers.
i am using
public function isValidNumber(s:String):Bo olean{
return Boolean(s.match(/^[0-9]+$/ ));
}
if i enter s = 55e or s = 6567y it returns false which is fine
but when i enter
s = 99.99
it returns false.
When decimal numbers example 99.99 is entered i want it to return true but when
99.aa is entered i want it to return false.
any idea how i can change my above function ?
thanks
I am looking for a regular expression which will check if there are
any alphabets in a string of numbers.
i am using
public function isValidNumber(s:String):Bo
return Boolean(s.match(/^[0-9]+$/
}
if i enter s = 55e or s = 6567y it returns false which is fine
but when i enter
s = 99.99
it returns false.
When decimal numbers example 99.99 is entered i want it to return true but when
99.aa is entered i want it to return false.
any idea how i can change my above function ?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.