fork(8) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var s = "Hello\nabc\nHello\ndef\nHello";
  12. var i = 0;
  13. var result = Regex.Replace(s, "Hello", m => string.Format("{0}{1}",m.Value,++i), RegexOptions.IgnoreCase);
  14. Console.WriteLine(result);
  15. }
  16. }
Success #stdin #stdout 0.02s 30136KB
stdin
Standard input is empty
stdout
Hello1
abc
Hello2
def
Hello3