fork download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. string mainstr = "NONSALE_REVENUE,SALE_REVENUE";
  10. string result = Regex.Replace(mainstr, @"(?<![^,])(?:NON)?SALE_REVENUE(?![^,])", "SUM($&)");
  11. Console.WriteLine(result);
  12. }
  13. }
Success #stdin #stdout 0.08s 19620KB
stdin
Standard input is empty
stdout
SUM(NONSALE_REVENUE),SUM(SALE_REVENUE)