[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

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?
0
steve_mick972
Asked:
steve_mick972
1 Solution
 
Bob LearnedCommented:
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now