Hi - I'm trying to use a regular expression to validate a data entry that has to be exactly 8 numeric digits. I tried
Regex _validGPID = new Regex(@"^\d{8}");
But that only catches entries that are less than 8 characters, not more. I also tried
Regex _validGPID = new Regex(@"^\d{8,8}");
But that didn't work either.
Can anyone help me out?
Regular Expressions
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Bryian TanRank #396 · 6.3K reputationPosted Sep 14, 2010, 5:06 PM EDT
Try something like this ^[\d]{8}$
Jeff3 reputationPosted Sep 15, 2010, 5:39 AM EDT
Bryian TanRank #396 · 6.3K reputationPosted Sep 15, 2010, 6:08 AM EDT