Regex & Regular Expressions

Nov 1 2006 11:34 AM
I'm trying to use regular expressions to validate a string before converting it to a number.  The string must be all numeric (obviously) and exactly 8 digits long.  I have tried all of the follow regular expressions:

"[0-9]{8}"
"\d{8}"
"[0-9]{8}$"
"[0-9]{8,8}"



The problem I am having is that the expression returns a Match.Success as long as the string is at least 8 digits long.  If it is 9 ot returns OK, and I want it to return false.

Any Ideas????

Thanks Ash..

Answers (3)