H
Hulk
Hello!
I have a following RegExp ^\d{5}?$
It should accept strings containing excatly fice numbers or an empty
string...
but it does not. Can anyone see whats wrong?
Code snippet checking this is below
// Sentence contains ^\d{5}?$
Regex RegExp = new Regex(Sentence, RegexOptions.IgnoreCase);
if(RegExp.Match(val).Success == false)
{
string text = "Validating Exception";
string keyAndValue = String.Format(" Key {0} with value {1} is
incorrect.", key, val);
throw new Exception(text + keyAndValue);
}
Cheers
I have a following RegExp ^\d{5}?$
It should accept strings containing excatly fice numbers or an empty
string...
but it does not. Can anyone see whats wrong?
Code snippet checking this is below
// Sentence contains ^\d{5}?$
Regex RegExp = new Regex(Sentence, RegexOptions.IgnoreCase);
if(RegExp.Match(val).Success == false)
{
string text = "Validating Exception";
string keyAndValue = String.Format(" Key {0} with value {1} is
incorrect.", key, val);
throw new Exception(text + keyAndValue);
}
Cheers