Regular expression for 9 digit number.

I am trying a match a 9 digit number.

 i am using the following code:

Regex my9DigitNumber = new Regex(@"9[0-9]");

it does not seem to work. Any Ideas?
LVL 1
steve_mick972Asked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Regex my9DigitNumber = new Regex(@"[0-9]{9}");

Great tutorial, if you don't know of it:
http://www.regular-expressions.info/

Bob
0
 
BurntSkyCommented:
You could also use:

"\d{9}"

To add to Bob's tutorial suggestion check out this site too:
http://www.regexlib.com/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.