string lastLowercaseChars = String.Empty;
var re = new Regex("[a-z]+$");
var match = re.Match("FrCABisch");
if(match.Success)
{
lastLowercaseChars = match.Value;
}
// lastLowercaseChars has your final result
int posLastUpper = 0:
for(int i = input.Length - 1; i >= 0; i--)
{
char c = input[i];
if(c.IsUpper())
{
posLastUpper = i;
break;
}
}
string lastLowercaseChars = input.Substring(posLastUpper);
var pattern = "^.+?([a-z]+)$";
List<string> input = new List<string>() {"FRCABisch", "FrCABisch", "YTkumoty"};
foreach (string str in input)
{
Console.WriteLine("Input string = {0} and the ending is = {1}", str, Regex.Match(str, pattern).Groups[1].Value);
}
The results will beInput string = FRCABisch and the ending is = isch
Input string = FrCABisch and the ending is = isch
Input string = YTkumoty and the ending is = kumoty
Open in new window