fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string pattern = @"(\d+)\(-\)";
  9. string substitution = @"(-$1)";
  10. string input = @"58(-)+69+32(-)*3
  11. 58(-)+69+32(-)*358(-)+69+32(-)*3
  12.  
  13. ";
  14. RegexOptions options = RegexOptions.Multiline;
  15.  
  16. Regex regex = new Regex(pattern, options);
  17. string result = regex.Replace(input, substitution);
  18. Console.WriteLine(result);
  19. }
  20. }
Success #stdin #stdout 0.06s 21328KB
stdin
Standard input is empty
stdout
(-58)+69+(-32)*3
(-58)+69+(-32)*(-358)+69+(-32)*3