Both the answers posted below are correct.
using System;
using System.Linq;
using System.Text.RegularExpressions;
namespace DemoConsoleApp
{
class Program
{
static void Main(string[] args)
{
string str = "Welcome to programming world";
int count = Regex.Matches(str, "r").Count;
Console.WriteLine(count);
var charCount = str.ToCharArray().Where(item => item.ToString().ToLower() == "r").Count();
Console.WriteLine(charCount);
Console.ReadKey();
}
}
}