fork(7) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. 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
  9. Regex regexEmoji = new Regex(@"\uD83D[\uDE00-\uDEFF]|[\u2600-\u26FF]");
  10. MatchCollection matches = regexEmoji.Matches(str);
  11. int count = matches.Count;
  12. Console.WriteLine(count);
  13. }
  14. }
  15.  
Success #stdin #stdout 0.06s 34048KB
stdin
Standard input is empty
stdout
4