fork(4) download
  1. using System;
  2. using System.Linq;
  3. using System.IO;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. var str = "I am nice and friendly and I like to wear ninja outfits";
  11. var rx = new Regex(@"(\band\b)");
  12. var res = rx.Split(str).Select(x => x == "and" ? x : !String.IsNullOrWhiteSpace(x) ? "<censured>" : "").ToList();
  13. Console.WriteLine(string.Join("", res));
  14. }
  15. }
Success #stdin #stdout 0.14s 24632KB
stdin
Standard input is empty
stdout
<censured>and<censured>and<censured>