using System; using System.Text.RegularExpressions; class Program { static void Main() { string str = "Hello world 😀🙏☀⛿"; // 1F600 GRINNING FACE, 1F64F PERSON WITH FOLDED HANDS, 2600 BLACK SUN WITH RAYS, 26FF WHITE FLAG WITH HORIZONTAL MIDDLE BLACK STRIPE Regex regexEmoji = new Regex(@"\uD83D[\uDE00-\uDEFF]|[\u2600-\u26FF]"); MatchCollection matches = regexEmoji.Matches(str); int count = matches.Count; Console.WriteLine(count); } }