A regular expression that will allow a string with only one Capital Letter
- by Phoenix
The string should be 6 - 20 characters in length.
And it should contain 1 Capital letter.
I can do this in code using C#
string st = "SomeString"
Regex rg = new Regex("[A-Z]");
MatchCollection mc = rg.Matches(st);
Console.WriteLine("Total Capital Letters: " + mc.Count);
if (mc.Count > 1)
{
return false;
}
But what i really want is a Regular expression that will match my string if it only contains one capital.
The string can start with a common letter and should have only letters.
Thanks In advance. (I did look at some of the other RegEx questions but they did not help).