fork(3) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string input = "a+aa-b";
  9. string variable = "a";
  10. string replacement = "1";
  11. Regex regex = new Regex(@"\b" + variable + @"\b");
  12. string result = regex.Replace(input, replacement);
  13. Console.WriteLine(result);
  14. }
  15. }
Success #stdin #stdout 0.07s 37224KB
stdin
Standard input is empty
stdout
1+aa-b