fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string[] inputstrings = { "ComputerPart", "topaz", "questions" };//An array of input strings to manipulate.
  9. string output = "";
  10. Regex rgx = new Regex("t");//Regex pattern to match occurence of 't'.
  11. foreach (string inputstring in inputstrings)//Iterate through each string in collection.
  12. {
  13. output = rgx.Replace(inputstring, "success", int.MaxValue, 1);//Replace each occurence of 't' excluding those ocurring at position [0] in inputstring.
  14. Console.WriteLine(output);//Show output string.
  15. }
  16. }
  17. }
Success #stdin #stdout 0.06s 34080KB
stdin
Standard input is empty
stdout
CompusuccesserParsuccess
topaz
quessuccessions